File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Cookie Expiration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Cookie Expiration" Watch "Cookie Expiration" New topic
Author

Cookie Expiration

Ty Caine
Greenhorn

Joined: Jan 30, 2003
Posts: 1
Hi everyone.
I'm setting a cookie with the following code:



then using a loop within the body of the page to retrieve the cookie name(s) and value(s), and yet when I request the MaxAge of the cookie(s) on the page with cookies[i].getMaxAge() it comes back as -1, even though it was originally set to 31536000.


Am I being dense, or am I missing something here?
Can anyone help me?
Thanks in advance
T.C.
[ January 31, 2003: Message edited by: Ty Caine ]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
If you are doing all this in one request, seems to me that since you are setting the cookie in the response, it won't appear until the next request.
Bill
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Cookie Expiration