Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Execute code when a session expires

 
Thomas Korsgaard
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Thomas.
Use HttpSessionListener.
 
Vishwanath Krishnamurthi
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic