To use, setmaxinactiveinterval(), do the following:

sess.setmaxinactiveinterval(secs);

where sess is the HTTP session object. and the parameter time is the time
in seconds.

HTTP is a stateless protocol. Requests from a browser are sent to a
seervlet using these protocol. The web server and it's servlets do not have
any means to know when the browser is closed. The server waits for the
specified timeout and then invalidates the session.

U can follow a roundabout way of updating the database. The update would
not occur immendiately but after some time. Put a variable in the session
object and implement the Httpbinding listener. After that check for the
valueUnbound event of this listerner. This event is triggered when this
variable is removed from the session object.

I think the session variable is removed when the session invalidates.

I have not tried this option before. Let me know if it works.

Regards
Shivashis




Sanika Kapoor <[EMAIL PROTECTED]> on 06/22/2000 08:30:19 PM

Please respond to "A mailing list for discussion about Sun Microsystem's
      Java              Servlet API Technology."
      <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:    (bcc: Shivashis Bose/fltpa/comsvc)

Subject:  session timeout



how do we use setmaxinactiveinterval(), I want to set my session timeout to
10 mins and also want to do some database updations if the user closes the
browser. Pl. help!!
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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

___________________________________________________________________________
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