GeeCON Prague 2014*
The moose likes Servlets and the fly likes valueUnbound problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "valueUnbound problem" Watch "valueUnbound problem" New topic
Author

valueUnbound problem

Mike Stan
Greenhorn

Joined: Feb 03, 2004
Posts: 1
Hi,
I'm trying to figure out how to close a user session when he or she closes the web browser.
The ValueUnbound event is invoked only when session timeout expires.
any ideas??
http://www.wirescale.com/
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
Oddly enough I just had to deal with this problem myself today. Check out this thread in the HTML/JavaScript forum.
From my code in that thread you can see how to fire off a JavaScript function when the browser is closed or a user navigates off of your site. That JavaScript function opens a new window and points to a servlet/JSP/Struts Action/whatever that does any cleanup you need done and invalidates the session. I use Struts, so I have my struts Action forward to a page that simply closes itself, thus getting rid of the popup you just opened. You can do this by placing on1oad="self.close()" (replace the number 1 with L there, UBB can be a pain sometimes) in your <body> tag.
HTH
 
GeeCON Prague 2014
 
subject: valueUnbound problem