About Servlet Listeners

See Also

Listeners allow you more control over interactions with the ServletContext and HttpSession objects and let you efficiently manage the resources used by a web module.

Application event listeners are classes that implement one or more of the servlet event listener interfaces. Application events let listener objects be notified when servlet contexts and sessions are initialized and destroyed, as well as when attributes are added or removed from a context or session.

Use Servlet context listeners to manage resources or state held at a virtual machine level for the web module. The IDE helps you create two types of context event listeners:

Use HTTP session listeners to manage state or resources associated with a series of requests made to a web module from the same client or users. The IDE helps you create two types of session event listeners:

Listener classes are declared in the deployment descriptor (web.xml) using the listener element. They are listed by class name in the order in which they are to be invoked.

The IDE provides a wizard to help you create listener classes. For more information about listeners, see the Java Servlet Specification available at http://java.sun.com/products/servlet/download.html.

See Also
About Web Modules
Creating a Listener
Adding a Listener to the Deployment Descriptor

Legal Notices