aspose file tools
The moose likes Servlets and the fly likes again session Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "again session" Watch "again session" New topic
Author

again session

Thirumalaisamy Thangavel
Greenhorn

Joined: Sep 29, 2006
Posts: 3
hi,
I have session variable for each user. When user clicks logout this will be made as null.But Instead of logout if the user closes the browser the session variable will not be null. So is there any way to make the session variable null when the user closes the browser.

thiru
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

No.
Sessions will time themselves out.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Siri Reddy
Greenhorn

Joined: Oct 20, 2006
Posts: 17
OR you can call the logout servlet when user closes the browser useing X button one the top right corner.
when user clicks on X button call the javascript function onUnload() and call Logout Servlet.
only problem is when user close the browser with close button under File Menu.

I Think this is userful for you.

Thanks,
Reddy
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4967

Don't you hate it when the user doesn't use our applications the way they are designed?

You cannot depend on the session being killed when the client closes the browser. It is difficult to predict the state of the session when a user enters an application. Make sure you handle your sessions appropriately, or your user might end up getting someone else's session, or not be able to navigate through your site properly.

-Cameron McKenzie


Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
 
I agree. Here's the link: http://jrebel.com/download
 
subject: again session
 
Similar Threads
logout on browser close
Spring mvc-Destroy Session after closing the browser?
Session handling
How to do logout when browser closes in jsf
Session