1. Create the following class public class test1 implements HttpSessionListener { public void sessionCreated(HttpSessionEvent se) { HttpSession sess = se.getSession(); System.out.println ("\nSession created, id : " + sess.getId() ); }
public void sessionDestroyed(HttpSessionEvent se) { HttpSession sess = se.getSession(); System.out.println ("Session destroy, id : " + sess.getId() ); // do you stuff here } } 2. add the following to web.xml <listener> <listener-class> test1 <!-- Your class name here --> </listener-class> </listener> Hope it helps Best Regards, Lim Yong How Software Engineer Ryeson Security International 180B Bencoolen Street #10-01/02 The Bencoolen Singapore 189648 www.ryeson.com <http://www.ryeson.com> ____________________________________________________________________________ ________________________ The information contained in this e-mail message is intended only for the use of the person or entity to whom it is addressed and may contain information that is CONFIDENTIAL and may be LEGALLY PRIVILEGED and exempt from disclosure under applicable laws. If you read this message and are not the addressee you are notified that use, dissemination, distribution, or reproduction of this message is prohibited. If you have received this message in error, please notify us immediately and delete the original message. ____________________________________________________________________________ __________________ -----Original Message----- From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Lambert Behnke Sent: Monday, 02 December, 2002 10:42 PM To: [EMAIL PROTECTED] Subject: Session timeout event Hello folks, I have a hopefully simple question. How can I catch the session timeout event. In essence I have a lot of information in need to keep in a user session and when he logs out of my system I write that information to a database. What I need for the next step though is to keep the information even if the user simply kills the browser window. I am not sure how it would work but at some point this session times out, at the instant I would like to call a simple function to write the information to a database. Any ideas ? Thanks for looking into this, Lambert *********************************************************************** This transmission contains information which may be confidential and which may also be privileged. It is intended for the named addressee only. Unless you are the named addressee, or authorised to receive it on behalf of the addressee you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please contact the sender. Thank you for your cooperation. *********************************************************************** For more information about AEA Technology please visit our website at http://www.aeat.co.uk AEA Technology plc registered office 329 Harwell, Didcot, Oxfordshire OX11 0QJ. Registered in England and Wales, number 3095862. ___________________________________________________________________________ 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