• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Piotr's mock exam question 48

 
Ranch Foreman
Posts: 1904
12
  • 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.
 
Screaming fools! It's nothing more than a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic