This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Session " Watch "Session " New topic


deepa raj
Ranch Hand

Joined: Jul 25, 2008
Posts: 124
Application is using cookies for session tracking.means cookies are enabled.

in this case Whether the session will be destroyed when we close the browser?

because when we close the browser cookies will be destroyed.

session object will be there in the container server-side but not in the client side.

am i correct?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by deepa raj:

when we close the browser cookies will be destroyed.

i think cookies will store into your system

check the path C:\Documents and Settings\yourname\cookies

correct me,if i am wrong
deepa raj
Ranch Hand

Joined: Jul 25, 2008
Posts: 124
hi seetharaman,

from HFSJ

i am reading the concepts only.. :-)
arun nohwar

Joined: Aug 05, 2008
Posts: 16
Cookies will definitely remain in the system, even if we close the browser.
The path to cookies is as mentioned by venky above.
In Internet explorer >> Tools >> Internet Options >> General Tab,
there is a Delete Cookies button, that will delete the cookies stored in system.
The closing of the browser does not trigger the deletion of cookies.
Hema Nandhini
Ranch Hand

Joined: Aug 04, 2008
Posts: 31
To add more details, if we are creating a cookie ourself, we can set the expiration time for that cookie using Cookie.setMaxAge(int). Setting the MaxAge as -1 will make the cookie to expire immediately when the browser is closed. Check this out for better understanding:

SCJP 1.4 (86%)<br />SCWCD 1.5 (88%)
It is sorta covered in the JavaRanch Style Guide.
subject: Session
Similar Threads
cookies and URL rewriting
Session Expiration Doubt
Question about URL rewriting
cookies exist when we close browser?
Question about HttpSession