• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Delete Records When user clicks close button of a browser

 
Nithish Yalamanchili
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no direct way to capture that event on the backend. What if the browser crashes or the user never closes the browser?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic