When declaring a listener in the DD, which sub-element of the element are required?
-
<listener-class>
-
<listener-type>
-
<listener-name>
-
<description>
When declaring a listener in web.xml, only is required - it specifies the fully qualified class name of the listener implementation. , , and are not valid or required sub-elements of . The listener class must implement the appropriate listener interface (ServletContextListener, HttpSessionListener, etc.).
In a web application's deployment descriptor, the element requires a sub-element specifying the fully qualified class name that implements the listener interface — this is how the container knows which class to instantiate and register for lifecycle/event callbacks. Elements like or are optional metadata, not required for the listener to function.