• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Listener

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HF S&J says only HttpSessionBindingListener need not be configured in DD rest all need to be configured.
But JQPlus says both HttpSessionBindingListener and HttpSessionActivationListener need not be configured in DD.

Which one is correct ?
 
Ranch Hand
Posts: 34
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JQPlus is right.

The two interfaces HttpSessionActivationListener and HttpSessionBindingListener are directly implemented by object designed to be added as session attributes.

The other listener interfaces are used to send events to objects that are not designed to be used as attribute.
 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I had the also experienced the same question in one of the mock exam in which they had asked to choose only one opiton from
HttpSessionBindingListener
HttpSessionActivationListener
HttpSessionListener

Cox many books also do say that only HttpSessionBindingListener needs to be configured in web.xml

Regards
Rohit
[ February 28, 2005: Message edited by: Rohit Bhagwat ]
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I repost my contribution to another recent thread about the same matter:

I think the Servlet 2.4 specs are a little confusing. They say in SRV.10.3.2:
"Listener classes are declared in the Web application deployment descriptor using the listener element."

which, I understand, means that all of the listeners must be declared in the DD.

But later, in SRV.15.1.10, the specs say:
"Events of this type are either sent to an object that implements HttpSessionBindingListener when it is bound or unbound from a session, or to a HttpSessionAttributeListener that has been configured in the deployment descriptor when any attribute is bound, unbound or replaced in a session."

which seems to indicate that HttpSessionBindingListener doesn't need (have) to be declared in the DD.

I really would appreciate any explanation.

What HFSJ say is that:
"...HttpSessionActivationListener must be registered in the DD, since they are related to the session itself, rather than an individual attribute placed in the session"

What about ServletRequestListener or ServletRequestAttributeListener? I think they must be declared in the DD, but I dont know it for sure.
 
This tiny ad is suggesting that maybe she should go play in traffic.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic