As far as I know, you can let session timeout and when the session is time outs, all the bean will be droped. At that point if your bean implements HttpSessionBindingListener interface, its valueUnbound() method will be called and that is the right place to drop your connection.
Regards,
Chandra
 
 

The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation.

 

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of rajesh nair
Sent: Tuesday, August 21, 2001 5: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