close session trigger event

I would like to trigger a event after the session close.

I try to close the session by the following code.

button {

FacesContext context = FacesContext.getCurrentInstance ();

HttpSession session = (HttpSession) context.getExternalContext

().getSession (false);

session.invalidate ();

}

those event triger by a button , and I found that it can trigger a even in session.destroy(), but if I close the browser , session.destroy does not trigger.

Do anyone can help me to solve this problem.

Thanks

[563 byte] By [mickeyleehk] at [2007-11-26 8:58:29]
# 1

It turns out that closing a browser does not call session.destroy() until the session timesout.

Ref: http://www.thescripts.com/forum/thread16690.html

you must include <session-timeout> in your web-xml. In other cases the

session never expires.

you could test with value=1 (one minute) to test.

Please also refer to:

http://forum.java.sun.com/thread.jspa?threadID=278182

How to capture browser closing event when user clicks on "X" of the browser

KarthikR at 2007-7-6 23:00:16 > top of Java-index,Development Tools,Java Tools...