tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Cookies.
Date Mon, 08 Dec 2003 15:52:45 GMT

> So, I have added the cookies value in servlet, and I can get the cookie
> value in jsp. When I work with the same browser fine working. But when close
> and open the new browser window I cant get the cookie values.
> Setting cookie,
> 	res.addCookie(new Cookie("entID",eID));
> 	res.addCookie(new Cookie("lgnId",lgnId));

I checked the javadoc documentation for the Cookie class, and it doesn't 
seem to mention the default "life" of a Cookie object once sent to the 
browser. I'm inclined to think that the default is that it will live as 
long as the browser session does (especially because of your evidence).

Try this:

Cookie cookie = new Cookie("entId", eID);


cookie = new Cookie("ognId", ignId);


This is likely to extend the life of your cookies beyond the browser's 
session. Therefore, they will be sent in requests after the browser is 


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message