File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Kill the Session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Kill the Session " Watch "Kill the Session " New topic

Kill the Session

rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
Session.invalidate() is a function to kill the Session.
Suppose a user close the broswer wihout proper logout, in that senario how to write a logic for that?
sudhir nim
Ranch Hand

Joined: Aug 29, 2007
Posts: 212

You can use session time out, so session will be invalidated automatically after specified time out time

[Servlet tutorial] [Servlet 3.0 Cook Book]
rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
that is the another sernario(after time out)
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

You have no reliable way to know if the user closed her browser or not.
Your app should never count on knowing when this happens.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Kill the Session
It's not a secret anymore!