You could do it if the servlet sent the client an applet.  Then, if you override
the public void stop() method of java.applet.Applet, the method will be 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
(e.g., the browser closes).   Just have the method call the servlet and inform
it that the applet is about to be destroyed.
In fact, a subclass of java.applet.Applet should override public void stop() if
it has any operation that it wants to perform each time the Web page containing
it is no longer visible.

Cheers!
Mark

----- Original Message -----
From: "Milt Epstein" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 29, 2001 8:29 AM
Subject: Re: CLIENT CLOSED/TERMINATED and more...


> On Thu, 29 Mar 2001, kal inuganti wrote:
>
> > Dear List Members,
> >
> > I am back with a basic question. It would be helpful if someone
> > could tell me how my server can detect if the client is disconnected
> > (what I mean by disconnected is - if the client closes the window)?
> > If the client is disconnected I want to invalidate a session.
>
> Basically, you can't do it with 100% reliability, so you're going to
> need to fall back on using a timeout.
>
>
> > And one more thing... If the client opens the same page in a new
> > window (^N in the same browser) I want the request to be redirected
> > so that a different session can be created. It would be helpful if
> > some pseudo code or directions can be given in this connection.
>
> Not sure you can do this, you may only be able to have one such
> session at a time.
>
> Milt Epstein
> Research Programmer
> Software/Systems Development Group
> Computing and Communications Services Office (CCSO)
> University of Illinois at Urbana-Champaign (UIUC)
> [EMAIL PROTECTED]
>
> ___________________________________________________________________________
> 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