Detecting the end of a session

Hi,Is there any way of detecting when a session ends? I'm wanting to carry out an action when the browser gets closed.Thanks!
[147 byte] By [giggipa] at [2007-11-27 2:28:33]
# 1

You probably have some User object that you store in the session. What you can do is you can implement the HttpSessionBindingListener interface on this object. The valueUnbound() method of that interface will be called when the session is dropped.

http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpSessionBindingListener.html

Note that a session does not end directly when the browser is closed, the session has to time out first on the server side.

gimbal2a at 2007-7-12 2:40:49 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
+1
citcrua at 2007-7-12 2:40:49 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Thanks for the reply.

I'm not too sure this is what I'm after. I'm quite new to JSP so forgive me.

Basically, I have a website which is an online shop. The basket uses a bean. I just want to empty the basket and update the database when the session ends.

Any ideas?

Thanks once again!

giggipa at 2007-7-12 2:40:49 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...