How to delete cookies in JSP?

Showing Answers 1 - 6 of 6 Answers

hari yogendra

  • Oct 25th, 2005
 

please explain How to delete cookies in JSP. please sir i want full details

  Was this answer useful?  Yes

Whenever you want to delete cookies, just set the Maxtime value to 0..

example given below.

    Cookie cookie = new Cookie ("myCookie", "theCookieValue");

    // Expire in five minutes (5 * 60)
    cookie.setMaxTime( 300 );

 some... more code here.. or  any other page..

// Expire after the browser is closed
    // cookie.setMaxTime( -1 );

    // Expire right now
    // cookie.setMaxTime( 0 );

I hope it works

  Was this answer useful?  Yes

Richard

  • Oct 31st, 2005
 

As the above answer mentioned, but the setMaxTime should be setMaxAge, setMaxTime doesn't exist.

  Was this answer useful?  Yes

AnsumanPattanaik

  • May 25th, 2006
 

RE: How to delete cookies in JSP?

  Was this answer useful?  Yes

venkat

  • Jul 21st, 2006
 

if u want to delete the cookies we hava an header called

response.setHeader("expires", mentionthetime attribute) so that for that prescribed time the cookies will get deleted

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions