File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Which Listeners are mandatory in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Which Listeners are mandatory in web.xml" Watch "Which Listeners are mandatory in web.xml" New topic
Author

Which Listeners are mandatory in web.xml

Yogesh Hingmire
Ranch Hand

Joined: Dec 06, 2005
Posts: 61
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

You only need to remember that both HttpSessionActivationListener and HttpSessionBindingListener are not.


[My Blog]
All roads lead to JavaRanch
Yogesh Hingmire
Ranch Hand

Joined: Dec 06, 2005
Posts: 61
Thanks Satou !!! It helps
Bhavna Jharbade
Ranch Hand

Joined: Sep 08, 2005
Posts: 69
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.


SCJP1.4 (86%)
Gunaselan Varathan
Ranch Hand

Joined: Nov 11, 2005
Posts: 30
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.


Guna<br />SCJP 1.4 86<br />SCWCD 1.4 94
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
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


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
Bhavna Jharbade
Ranch Hand

Joined: Sep 08, 2005
Posts: 69
Thank You Gunaselan & Narendra..
now i am crystal clear abt this concept
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Which Listeners are mandatory in web.xml