• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to track activesession

 
saxena Amit
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When a user closes the window (you cannot know the session is killed),
his session is still active.
I want to invalidate his session prior to the session timeout.
Is there a way in SERVLET to invalidate the session of a user who closed the browser without logging out.
Pl help, its urgent.
 
srinath anand
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the session.invalidate() method.
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there a way in SERVLET to invalidate the session of a user who closed the browser without logging out.


There is no way to invalidate the session when the user close the browser window, because there is no way to know the container about this event (Closing window). But yo can programatically invalidate your session in servlet when you want using HttpSession.invalidate() method.

Thanks
 
Sushma Sharma
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only way possible is to use java script to capture the window Close and call a java script function.... from there you can try invalidating the session....

what do you say, gurus???

Regards,

Sushma
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!