During the lifetime of a typical web application, a number of events take place, such as HTTP requests getting created or destroyed, request or session attributes getting added, removed or modified, and so on and so forth.
The servlet API provides a number of listener interfaces we can implement in order to react to these events. All of these interfaces are in the javax.servlet
package, and the following table summarizes them:
Listener interface | Description |
| Contains methods for handling context initialization and destruction events. |
| Contains methods for reacting to any attributes added, removed, or replaced in the servlet context (application scope). |
| Contains methods for handling request initialization and destruction events. |
| Contains methods for reacting to any attributes added, removed, or replaced in the request. |
| Contains methods for handling HTTP session... |