This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Servlets and the fly likes confusing cookies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "confusing cookies" Watch "confusing cookies" New topic

confusing cookies

sushant prabhu
Ranch Hand

Joined: Mar 22, 2001
Posts: 66
i hav been using cookies . if cookies r used for session tracking
they ideally r of no use once the session expires (i.e once the user closes his browser window) then what is the point in giving a max age of n number of days to the cookie so that it resides for that number of days on the client side.
as i assume when the user closes his browser andthen again requests for the page a new session will be started for which another cookie will be set .

i hav made a simple cookie example which i create it one servlet ,
give it a max age of 2 days and then add it to httpresponse object and retrieve it on the second servlet. now i open one ie browser window use that servlet and see the cookie value in the second servlet and close the browser. now ideally this cookie must reside in my machine for 2 days. i can see the cookie in the temp internet files
now after that i open another browser window again request for the same servlet now again i retrieve the content of the cookie
but it doesnot create another cookie txt file in theTemp internet files but just replaces the previous cookie.txt file with the new value i giv to the cookie. ideally what should happen in such a scenario.
the getCookies method associated

Sushant Prabhu<br />SCJP2<br />SCWCD<br />OCA9i
I agree. Here's the link:
subject: confusing cookies
jQuery in Action, 3rd edition