This section contains the details about Configuring Listener in web.xml
Configuring Listener in web.xml
Since Listeners are basically servlet , they need to configure in web.xml or deployment descriptor. So that server can invoke it when needed.
Given below the syntax for configuring it into servlet :
<listener> <listener-class>Listener-name1</listener-class> <listener-class>Listener-name2</listener-class> . . </listener>
The 'Listener-name' is the full qualified name of the listener class (with package name etc).
Example
<listener> <listener-class>dev.myContextListenerClass</listener-class> <listener-class>dev.mySessionAttributeListenerClass</listener-class> </listener>
[ 0 ] Comments