People tend to forget that HTTP protocol is STATELESS.So you don't have an open connection which is closed when the browser closes.Whenever an object is added to or removed from any session, the container introspects the interfaces implemented by that object. 201-301 Tel # 91-120-2423281, 2423282 Fax # 91-120-2423279 URL http// This message may contain confidential and/or privileged information.

No way is guaranteed to work (across all major browsers and their different versions).

Your connection could be dropped, or power go down which would make any 'on Close' event unreliable.

But, the function is also called when the user refreshes the page.

I have also considered using the interface Disposable Bean but its dispose() method is also called when the browser is refreshed.

These events as their name suggest, gets triggered whenever the page gets unload.

This happens if user close the browser or move to different page.I need to find a way to invalidate the session when the user closes the browser.We are currently calling a servlet from a javascript function that is called via the onunload function.I have been looking at the pages of the banks and seems to works ok, so I suposse there will be a way to face this.Maybe the ICEfaces developers could clarificate how to face this kind of stuff. The server will invalidate your session anyway after X minutes of inactivity.The Http Session Binding Listener interface is implemented by the classes whose objects need to receive notifications whenever they are added to or removed from a session.