aspose file tools*
The moose likes Servlets and the fly likes Sessions in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Sessions in JSP" Watch "Sessions in JSP" New topic
Author

Sessions in JSP

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Mar 22, 2000
Posts: 12825
    
    5
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

Joined: Jan 30, 2000
Posts: 3222
    
    5
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


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Sessions in JSP