Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Clarify my doubt in listeners

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can anyone let me know the answer of this question. Thanks in advance.

Which of the following listeners are not configured in the deployment descriptor? Select two choices.

a. ServletContextListener
b. ServletContextAttributesListener
c. HttpSessionAttributeListener
d. HttpSessionActivationListener
e. HttpSessionBindingListener
f. HttpSessionListener
 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From my knowledge correct choice is only one not two
HttpSessionBindingListener.
Correct, me if I am wrong.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also HttpSessionActivationListner
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Which of the following listeners are not configured in the deployment descriptor? Select two choices.

a. ServletContextListener
b. ServletContextAttributesListener
c. HttpSessionAttributeListener
d. HttpSessionActivationListener
e. HttpSessionBindingListener
f. HttpSessionListener



Correct options are D and E. Like HttpSessionBindingListener, there's no need to configure the HttpSessionActivationListener implementation class in the DD.

Regards,
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to Head First Servlets and JSP, HttpSessionActivationListener must be registered in the DD because it is directly related to the session and not to an attribute. (2nd Ed. Page 256). HttpSessionBindingListener does not need to be registered.
 
Kunal Jag
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

According to Head First Servlets and JSP, HttpSessionActivationListener must be registered in the DD because it is directly related to the session and not to an attribute.



Please check the errata list of your favorite book.

Regards,
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the errata :
[b]
Change the title to "You do NOT configure ALL session listeners in the DD!"[/b]


looks confusing. At first glance, i take it that ALL session listeners do not need any DD configuration!
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check that FAQ.
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HttpSessionActivationListener
HttpSessionBindingListener

These two listeners do not need to be configured in the deployment descriptor.

Here's an excerpt taken from David Bridgewater's post in javaranch (https://coderanch.com/t/170002/Web-Component-Certification-SCWCD/certification/HttpSessionActivationListener-configured-DD)
A part of the API doc for HttpSessionActivationListener:
"Objects that are bound to a session may listen to container events notifying them that sessions will be passivated and that session will be activated. A container that migrates session between VMs or persists sessions is required to notify all attributes bound to sessions implementing HttpSessionActivationListener."
It's the objects that do the listening (not the container) - so no need for a DD entry.

For the 2nd you know the answer.
 
I'm doing laundry! Look how clean this tiny ad is:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic