Multiple choice technology web technology

Which of the following is used to define a Listener for HttpSessionListener class in Web Deployment Descriptor?

  1. <session-listener>

  2. <listener>

  3. <http-session-listener>

  4. A listener for HttpSession cannot be specified statically inside a Deployment Descriptor, instead it can be programmatically mentioned.

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

Listeners are configured in web.xml using the tag with a subelement specifying the fully qualified class name. Options A and C are not valid tags. Option D is incorrect - listeners CAN be specified statically in deployment descriptors.