again session

hi, I have session variable for each user. When user clicks logout this will be made as null.But Instead of logout if the user closes the browser the session variable will not be null. So is there any way to make the session variable null when the user closes the browser.

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.

Don't you hate it when the user doesn't use our applications the way they are designed?

You cannot depend on the session being killed when the client closes the browser. It is difficult to predict the state of the session when a user enters an application. Make sure you handle your sessions appropriately, or your user might end up getting someone else's session, or not be able to navigate through your site properly.