Re: How to clear the session variables by closing the browser window?
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.