• Post Reply Bookmark Topic Watch Topic
  • New Topic

Piotr's mock exam question 48  RSS feed

Himai Minh
Ranch Hand
Posts: 1573
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Q48 - Servlet Listeners

Which statements are true about the listeners in Servlets 3.0:
a. Every listener implementor must provide a public, no argument constructor
b. Every listener implementor must not provide any constructor; a default, compiler generated one should be created
c .All listeners can be registered within the Deployment Descriptor
d. The listeners are invoked in the order in which they were registered

a, d

Reference: pages 111 - 112, 11.3 "Listener Class Configuration"

Explanation: Every listener class must provide a public, no argument constructor. There is no requirement that this constructor must be compiler generated.

The HttpSessionActivationListener and HttpSessionBindingListener are not registered in the DD.

The AsyncListener cannot be registered in the DD - it must be registered programmatically.

I have a question for option d. The order of the listeners are based on the order defined in DD. But if the listeners are defined only with annotation @WebListener, the order is not specified.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!