dcsimg
How to clear the session variables by closing the browser window?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Yinyong_Khoo
Posted On:   Saturday, September 27, 2003 01:28 AM

hi,
I would like to know what are the codes for clearing session variables when a user closes off the browser window? I am very unsure of how it is going to be done and I am very appreciative of the help provided. Code examples will be very useful. Thanks!

Re: How to clear the session variables by closing the browser window?

Posted By:   Eelco_Cramer  
Posted On:   Monday, September 29, 2003 11:58 PM

The session is cleared automatically when a session timeout occurs (the timeout is configured in your application server). You can invalidate a session from within your code by calling the invalidate method on a javax.servlet.http.HttpSession instance. If you want to cleanup stuff automatically when a session is destroyed, you can implement the javax.servlet.http.HttpSessionListener interface and configure the implementing class in you application descriptor (web.xml). The session listener is called just after a session is created and just before it is destoryed.
About | Sitemap | Contact