11.2. Bundling Listeners with Tag Libraries

Application life-cycle event listeners are described in Chapter 10. They provide a powerful new capability that lets you respond to the creation and deletion of the servlet context and HttpSession objects and lets you monitor changes in servlet context and session attributes. In most cases, listeners are declared with the listener element of the deployment descriptor (web.xml).

However, suppose that the behavior of a tag library depends upon an event listener. In such a case, you would want to be certain that the listeners were available in all Web applications that used the tag library.

If the listener and listener-class elements of web.xml were the only option for declaring listeners, tag library ...

Get More Servlets and JavaServer Pages™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.