aspose file tools*
The moose likes JSP and the fly likes Delete Records When user clicks close button of a browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Delete Records When user clicks close button of a browser" Watch "Delete Records When user clicks close button of a browser" New topic
Author

Delete Records When user clicks close button of a browser

Nithish Yalamanchili
Greenhorn

Joined: Aug 16, 2007
Posts: 24
In my jsp page there is no logoff/signout button. But when user logins some data is stored in table. I want to delete that data when user closes browser directly by clicking close button of browser.

Nithish
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
There is no direct way to capture that event on the backend. What if the browser crashes or the user never closes the browser?


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

What do have are session listeners which will fire events when the session is created or destroyed.
From your perspective, you shouldn't care why the session ends, you only care that the resources are cleaned up when it does.
See:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSessionListener.html


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Delete Records When user clicks close button of a browser