O'Reilly logo

Servlet & JSP: A Tutorial, Second Edition by Budi Kurniawan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9

Listeners

The Servlet API comes with a set of event classes and listener interfaces for event-driven programming in servlet/JSP applications. All event classes are derived from java.util.Event and listeners are available in three different levels, the ServletContext level, the HttpSession level, and the ServletRequest level.

This chapter demonstrates how to write listeners and use them in servlet/JSP applications.

Listener Interfaces and Registration

The listener interfaces for creating listeners are part of the javax.servlet and javax.servlet.http packages. They are listed below.

  • javax.servlet.ServletContextListener. A listener to respond to servlet context lifecycle events. One of its method is called right after the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required