How to persist a cookie?

Posted by user246114 on Stack Overflow See other posts from Stack Overflow or by user246114
Published on 2010-05-16T16:43:19Z Indexed on 2010/05/16 16:50 UTC
Read the original article Hit count: 157

Filed under:
|
|

Hi,

I am creating a cookie in a jsp script, which is located at:

www.myproject.com/login/index.jsp

if I restart the browser and navigate there, all works well, I can see the cookie persist. If I navigate to:

www.myproject.com

I am not seeing the cookie. Do I need to set something in the cookie path or domain to make the cookie visible to the entire [myproject.com] domain (I just want to access the cookie from whatever sub path the user may be on). I am creating the cookie like:

Cookie c = new Cookie("thisisatest", "foo");
c.setMaxAge(60 * 24 * 3600);
response.addCookie(c);

Thanks

© Stack Overflow or respective owner

Related posts about jsp

Related posts about servlets