File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Session Expiration Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Session Expiration Doubt " Watch "Session Expiration Doubt " New topic

Session Expiration Doubt

Sandeep Vaid
Ranch Hand

Joined: Feb 27, 2006
Posts: 392
Q-2 . P-248,
Session cookie vanish when the client's browser quits, but you CAN tell a cookie to persists on the client even after the
browser shuts down.. (by specifying time-out as -1 in web.xml)

So this means if i have not specified the time-out as -1 in web.xml, the session will be invalid when the client closes his
browser ?
Louis Moloney
Ranch Hand

Joined: Feb 06, 2007
Posts: 59
I think your alittle confused between session cookies and persistent cookies.

when you add a cookie to a response this will persist between opening and closing of the browser.

when you close a browser its session cookies (not cookies) will disappear from the browser. But the session will be alive on the web server as to such time as it times out.

Sandeep Vaid
Ranch Hand

Joined: Feb 27, 2006
Posts: 392
What is persistent cookie ?

HFSJ P-248 states that :
Session cookie vanish when the client's browser quits

Now when i am executing this for the first time, it's showing me : New Session


Now when i access the servlet again, it shows me : Old Session

This means that session cookie DOESN'T Vanish even after i close my browser.

I am using mozilla, and i can see option :
Accept cookies from site:
Keep until : a) they expire
b) I close firefox
c) ask me everytime

Currently i have selected option a)

Does the concept has to do something with these options ?
I agree. Here's the link:
subject: Session Expiration Doubt
It's not a secret anymore!