This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Servlets and the fly likes Session need to be destroyed when browser closes Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Servlets
Reply locked New topic
Author

Session need to be destroyed when browser closes

Satchidananda Mohanty
Ranch Hand

Joined: Mar 12, 2008
Posts: 77

Hi there,

In one web application I use java,jsp,servlets,struts.
Just wanted to destroy the session when the browser is closed by the end user.
Where I can put some code to destroy the session and update the status of that user in the database.

Briefly in that application I have restricted multiple login of the same user.
So if the user closes the browser without clicking the log out then the status of the user in the database Should update for the next time login.

Kindly help .


Thanks in advance.

Zeet

SCJP 6.0
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56554
    
  14

This has been discusses dozens of times. Please SearchFirst for previous discussions.

The synopsis is that there is no way to reliably know when the browser closes so you need to rely upon the session timeout.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Session need to be destroyed when browser closes
 
Similar Threads
Spring mvc-Destroy Session after closing the browser?
Will the jsp execute if a user closes the browser?
Session handling
Session
User Athentication ( Login / Password )