OR you can call the logout
servlet when user closes the browser useing X button one the top right corner.
when user clicks on X button call the javascript function onUnload() and call Logout Servlet.
only problem is when user close the browser with close button under File Menu.
I Think this is userful for you.
Thanks,
Reddy