• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Listeners with no DD entry

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which listerners do not require any entry in the DD?
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think HttpSessionActivationListener doesn't reqd to be placed in DD.

Guys, please correct me if I am wrong.
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HttpSessionActivationListener and HttpSessionBindingListener doesn't need to be placed in web.xml because these listener notify the objects that are bound to a session and not the session itself.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check this FAQ.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I remember only HttpSessionBindingListener should not be declared in web.xml.
Other listeners (HttpSessionActivationListener also) should be declared.

Sorry maybe I'm wrong because I saw a lot diff posts about this topic. One of them is following (Head First Servlet & JSP 2-nd edition page 256)
"HttpSessionListener and HttpSessionActivationListener must be registered in the DD, since they’re related to the session itself, rather than an individual attribute placed in the session."


 
Ranch Hand
Posts: 47
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Oleksandr Usatyy wrote:As I remember only HttpSessionBindingListener should not be declared in web.xml.
Other listeners (HttpSessionActivationListener also) should be declared.

Sorry maybe I'm wrong because I saw a lot diff posts about this topic. One of them is following (Head First Servlet & JSP 2-nd edition page 256)
"HttpSessionListener and HttpSessionActivationListener must be registered in the DD, since they’re related to the session itself, rather than an individual attribute placed in the session."




You are right.
Book says...

===============================
You do NOT confi gure session
binding listeners in the DD!

If an attribute class (like the Dog class here) implements the
HttpSessionBindingListener, the Container calls the event-
handling callbacks (valueBound() and valueUnbound()) when
an instance of this class is added to or removed from a session.
That’s it. It just works. But this is NOT true for the other session-
related listeners on the previous page. HttpSessionListener
and HttpSessionActivationListener must be registered in the
DD, since they’re related to the session itself, rather than an
individual attribute placed in the session.
===============================
But http://faq.javaranch.com/java/DeclaringListeners explains, Classes implementing interfaces other than HttpSessionBindingListener and HttpSessionActivationListener need to be declared in DD.
 
What is that? Is that a mongol hoarde? Can we fend them off with this tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic