*
The moose likes Servlets and the fly likes Execute code when a session expires 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 "Execute code when a session expires" Watch "Execute code when a session expires" New topic
Author

Execute code when a session expires

Thomas Korsgaard
Greenhorn

Joined: Oct 15, 2009
Posts: 2
Hi,

I want to execute some code when a session expires. Can anybody give me a hint on how to do this?

Thanks
/Thomas
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi, Thomas.
Use HttpSessionListener.
Vishwanath Krishnamurthi
Ranch Hand

Joined: Jun 04, 2007
Posts: 331
This can be done by using a HttpSessionListener. You can have your Java Program implement this interface. The sessionDestroyed() method here is invoked when the session expires. So you can put the required statements in this method.


Blog
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Execute code when a session expires
 
Similar Threads
when a request expires
Another question about sessions
How to Execute Session Destroying code in jsp
How to ristrict multiple login's at the same time using same username?
What happens to session object when session expires