Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which Listeners are mandatory in web.xml

 
Yogesh Hingmire
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello People,

Out of the 8 Listeners,

ServletContextListener
ServletContextAttributeListener

ServletRequestListener
ServletRequestAttributeListener

HttpSessionListener
HttpSessionAttributeListener

HttpSessionBindingListener
HttpSessionActivationListener

Which of them are mandatory from declaration in the web.xml point of view.

Thanks for the help

Regards,
Yogesh.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You only need to remember that both HttpSessionActivationListener and HttpSessionBindingListener are not.
 
Yogesh Hingmire
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Satou !!! It helps
 
Bhavna Jharbade
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi satou

i have a doubt on this i think only HttpSessionBindingListner ia not required to be mentioned in web.xml

though not very sure abt it.

anyone else please clarify.

thanks in advance.
 
Gunaselan Varathan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ServletContextListener
ServletContextAttributeListener

ServletRequestListener
ServletRequestAttributeListener

HttpSessionListener
HttpSessionAttributeListener



Only these Listeners are mandatory.

following listeners need not be specfied in the web.xml, if your using HFSJ, pls check the errata there is a correction on this.

HttpSessionBindingListener
HttpSessionActivationListener

for Bhavana: Think these attributes are for the containers to take care off.
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Following is my understading about the Activation and Bonding Listeners.

The HttpSessionActivationListener and HttpSessionBindingLister are implemented by the attribute classes , which are added as session attributes.

HttpSessionActivationListener is notified when the attribute implementing it is migrated to another JVM.

HttpSessionBindingListeren is notified when the attribute implementing is is bounded or unbounded to session.

For the other attributes which are not implementing these Listeners, are not notified for the above events.

So for both there is no need to register in web.xml, because these are related to the attributes added to the session.

Alll other 6 listerers are related to lifecycle and attributes added to different scopes, so the container require to register it.

Hope this help.

Thanks
 
Bhavna Jharbade
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You Gunaselan & Narendra..
now i am crystal clear abt this concept
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic