A reliable method is to embed an applet on the page, and inside of its
"stop" method send a signal back to the server that the page is closing
(browser is closing, or the user is moving on to another page). According to
the JDK 1.2 dox for java.applet.Applet,

"Called by the browser or applet viewer to inform this applet that it should
stop its execution. It is called when the Web page that contains this applet
has been replaced by another page, and also just before the applet is to be
destroyed. "

That's about the best that I can see that you can do, though.

Ted Neward
Patterns/C++/Java/CORBA/EJB/COM-DCOM spoken here
http://www.javageeks.com/~tneward
 "I don't even speak for myself; my wife won't let me." --Me

-----Original Message-----
From: Simon Christian <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, July 27, 1999 3:10 AM
Subject: Re: In servlet, how to know that the broswer's window is closed?


>You don't. However if you are using sessions, they are automatically
>invalidated after a set period of time of inaction on the part of the
>client/browser, dependent on your servlet engine (30 minutes is normal).
>
>Any HttpSessionBindingListener interface is notified of this event via the
>valueUnbound method. Check the servlet API documentation for details.
>
>You could theoretically use Javascript of an applet on each page that lets
you
>know when the window is closed, but it's not really necessary and not a
>reliable method.
>
>- simon
>
>Xizhen Wang wrote:
>
>> Hi! all,
>>
>> In servlet, how to know that the browser's window is closed?
>>
>> thanks!
>>
>>
___________________________________________________________________________
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to