On Tue, 21 Aug 2001, Jen wrote:
> When I tested the HttpSessionBindingListener, when the
> user close the browser the unBoundValue() is not
> called. It is called until the session times out.
Right. This discussion has come up many times before (check the
archives), and the consensus has been that basically there is no 100%
guaranteed reliable way to sense that the browser has closed or that
the user has moved on to other pages -- it's the nature of the HTTP
request/response, stateless paradigm. Hence you're going to have to
rely on a timeout in addition to any explicit "logout" function you
have.
FWIW, a couple of the "best" suggestions to do the kind of thing you
want were to use JavaScript or a small Java applet. Again, check the
archives for more info.
> --- Nic Ferrier <[EMAIL PROTECTED]> wrote:
> > Rajesh said:
> > What we want is:
> > if user closes the browser
> > Or
> > goes to some other website, either by
> > explicitly typing the URL, or
> > clicking on browser back
> > and forward buttons, then we want to invalidate
> > the session and close
> > the connection.
> > So how do I trap the browser close event and how
> > do I trap whether the
> > user
> > has left the website or not.
> >
> > This is basic stuff. You just put an object on the
> > session which implements
> > HttpSessionBindingListener. If you do that your
> > listener object will recieve
> > an event when the session dies (ie: the user closes
> > the browser or has
> > surfed on for a significant time). You can then
> > obtain the Connection from
> > the session and close it.
> >
> > This has been discussed (about a gazillion times)
> > here on this list.
> >
> > Check the archives and other sites for more details.
> >
> >
> > Nic Ferrier
> >
> >
> ___________________________________________________________________________
> > 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
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
> ___________________________________________________________________________
> 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
>
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