What is an Application Event? (see Servlet Spec 2.3)

Alessandro A. Garbagnati

If I've understood correctly, the Application Event of Servlet 2.3 is Sun's answer to one of the most request festures to servlets, which is an easy way to monitor, and reacts to, specific events that happen during the lifecycle of an application.

The idea is very similar to a Swing event. A developer can set up listeners on the objects that needs to be monitored and receive an event object, so can react appropriately.

For example a programmer can create a listener on a session object inplementing the HttpSessionListener interface, that has two methods:
void sessionCreated(HttpSessionEvent evt) that is fired when a new session object is created;
void sessionDestroyed(HttpSessionEvent evt) that is fired when a new session object is destroyed or invalidated;

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.