Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sessions in JSP

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i be notified that my client has left my page or has closed the explorer window so that i can perform some task before invalidating his session.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With a normal structure of user request - server response, you can't tell what the user is doing. If you absolutely have to know when the user has "left" - you could put an invisible applet on the page that keeps up a "heartbeat" of requests - but thats a lot of trouble.
If all you need to do is some upkeep before the servlet engine invalidates the session by timing out, look into the
HttpSessionBindingListener interface
which can be notified when the session is about to be destroyed.
Bill

------------------
author of:
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moid: Please read the username policy of JavaRanch. In particular single name usernames are not permitted. Thanks.
The policy, which must be adhered to, is at
http://www.javaranch.com/ubb/Forum10/HTML/000180.html
Thanks again and welcome to JavaRanch.
---
Sheriff Tony
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic