Abdul,

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.setMaxAge(cookie_life_in_seconds);

res.addCookie(cookie);

cookie = new Cookie("ognId", ignId);
cookies.setMaxAge(cookie_life_in_seconds);

res.addCookie(cookie);

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 restarted.

-chris


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to