my dog learned polymorphism*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 12761
    
    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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Sessions in JSP
 
Similar Threads
SUN where's our beta Mock questions?
Spring Email: Creating email content using a templating library
abstract class
how to read from an specefic offset of file ?
How to get model of a printer in javax.print?