File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Head First Android
this week in the
Found Answer on to Delete a Cookie in servlet Request
Joined: Oct 03, 2008
Jan 21, 2011 14:36:11
I asked how to delete a cookie in a
. I was always trying something like:
c.setMaxAge(0); //delete it c.setPath("/"); // anywhere on your work station response.addCookie(c);
but cookie would never go away. I would add setDomain, setSecure, etc, etc.
The trick is also to set the value. Why do you need to set a value if you are going to delete a cookie? Uhm,
anyway the following actually deletes a cookie
c.setMaxAge(0); //delete it c.setPath("/"); // anywhere on your work station c.setValue("timeToDelete"); response.addCookie(c);
I agree. Here's the link:
subject: Found Answer on to Delete a Cookie in servlet Request
setMaxAge(0) doesnt delete cookie?
Delete cookie code is not working in Opera and Mozilla browsers
can we retrieve cookie with JSP added thru servlet
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015