How to delete information from cookies?

I used webservice in my application and I want to delete information from cookies that are stored in one state, and they must be deleted in another state under a certain condition. How can i do this? Thanks

+4
source share
1 answer

check out http://www.ehow.com/how_5169279_remove-cookies-java.html

How to remove cookie from JSP page?

The cookie, mycookie, can be deleted using the following scriptlet:

<% Cookie killMyCookie = new Cookie("mycookie", null); killMyCookie.setMaxAge(0); killMyCookie.setPath("/"); response.addCookie(killMyCookie); %> 

How to delete a cookie using a servlet?

Get the cookie from the request object and use setMaxAge(0) , and then add the cookie to the response object.

http://www.hccp.org/java-net-cookie-how-to.html

+7
source

All Articles