On Fri, 15 Mar 2002, Lauer, Oliver wrote:

> Date: Fri, 15 Mar 2002 11:30:05 +0100
> From: "Lauer, Oliver" <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: 'Tomcat Users List' <[EMAIL PROTECTED]>
> Subject: AW: session listener
>
> Hi,
>
> you can create an object that implements HttpSessionBindingListener and
> store this object in your current session. This object will then be informed
> when the session gets bound and unbound.
>

Oliver's solution works for both Servlet 2.2 (Tomcat 3.x) and Servlet 2.3
(Tomcat 4.x).  If you are using Tomcat 4, however, you do have an
additional option -- you can register application event listeners in the
web.xml file that are notified of interesting events (such as session
creation and deletion, or changes to session attributes).  The "/examples"
webapp has some <listener> elements to show you how they are registered.
Look in the API Javadocs for the following APIs:
  javax.servlet.ServletContextListener
  javax.servlet.ServletContextAttributeListener
  javax.servlet.http.HttpSessionListener
  javax.servlet.http.HttpSessionActivationListener
  javax.servlet.http.HttpSessionAttributeListener
for the interfaces you must implement.  The functionality is defined in
the Servlet 2.3 specification, which you can download at:

  http://java.sun.com/products/servlet/download.html


> Oliver


Craig


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to