Another thing to consider: put your page within a frame.  When users close the browser or go to other side, it will cause the frame to be unloaded.  When it happens call your logoffServlet.java.
 
Andi
-----Original Message-----
From: rajesh nair [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 21, 2001 6:19 AM
To: [EMAIL PROTECTED]
Subject: Invalidating session and closing the connection

Hi All,

I want to know if anybody has a complete solution to the problem described below:

In our application (java- servlet based), when the user logs into the  website, user specific connection object is created and stored into session and throughout the user session, on every page that the user visits,

the connection object is retrieved from the session and used to fetch the records from DB.

Now when the user explicitly logs out by clicking on logout button, then a servlet(logoffServlet.java) is invoked which retrieves connection from  session, closes it and then invalidates the session.

What we want is:

if user closes the browser

 Or

goes to some other  website, either by explicitly typing the URL, or clicking on browser back

and forward buttons, then we want to invalidate the session and close the connection.

So how do I trap the browser close event and how do I trap whether the user

has left the website or not.

 Regards

Rajesh Nair

Reply via email to