Metawerx Java Hosting Small Logo


This element registers a listener with the Web container.

The data provided between the tags is the fully qualified class name for the listener class.

The class must implement one or more interfaces from the javax.servlet API, and also have a public constructor that takes no arguments. See the examples for more information on each interface.

The order in which listeners are invoked, is the same as the order they are registered in, which is the order they appear in the deployment descriptor (web.xml file).

The container instantiates each listener class before executing any requests. However, there is nothing to prevent a listener and request being executed at the same time according to the specification.

Example code demonstrating the <listener> and <listener-class> elements:

See Also

metawerx specific

referring pages