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 Servlets and the fly likes session.invalidate 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 » Java » Servlets
Bookmark "session.invalidate" Watch "session.invalidate" New topic
Author

session.invalidate

amit ang
Ranch Hand

Joined: Sep 28, 2001
Posts: 38
Hi All,
Can anyone help me?
I have implemented HttpSessionListener and have implemented the methods for Create and Destroy the session.
now when i hit the page with a browser i get the message from the Create method. But, when i close the browser i don't get the message from the Destroy method (I hope when you close the browser the session should be invalidated).
Any seggestions?
Thanks in Advance
Amit
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
No, the session will not be invalidated when you close the browser. There is no way for the server to know when the browser closes. If the server tries to send a response then an exception will be thrown. You can use JavaScript to determine when the browser window is being closed and then meybe send a message to the backend to indicate that.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Engin Okucu
Ranch Hand

Joined: Feb 09, 2002
Posts: 174
i'm intersted to try it with destroy method.
But i have any knowledge with Javascript. Can your reply to write the code(Javascript) to do it ?
Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: session.invalidate
 
Similar Threads
How to destroy session attribute?
session object
destroy not called
Error: not enough memory
when is the destroy method called?