Multiple choice technology programming languages

When declaring a listener in the DD, which sub-element of the element are required?

  1. <listener-class>

  2. <listener-type>

  3. <listener-name>

  4. <description>

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

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.).

AI explanation

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.