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

How to remove the session value...

vishnu mohan

Joined: Feb 01, 2002
Posts: 14
hi, how can i kill all the session value, while the USE CLOSE THE BROWSER. which servlet METHOD i called before closing the browser.
Thanks and regards,Vishnu
ersin eser
Ranch Hand

Joined: Feb 22, 2001
Posts: 1072
Hi Vishnu,
We have a naming policy here at JavaRanch where all publicly displayed names take the form, "Firstname Lastname". Could you please change yours to bring it into line?
Thanks in advance and we hope that you enjoy your stay at the JavaRanch!

Rajendar Goud
Ranch Hand

Joined: Mar 06, 2002
Posts: 220
Hi vishnu,
u can use the invalidate() method for removing a session.
<% session.invalidate(); %>
Invalidates the session and removes all objects stored within the session.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

The javascript event onUnLoad will be called when the browser is closed ..but it is also called when the refresh button is called...
Better set the session time out in web.xml or programmatically using setMaxInactiveInterval of HttpSession i/f so that session is killed after the set interval of inactivity...

I agree. Here's the link:
subject: How to remove the session value...
It's not a secret anymore!