• 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
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Sessions

 
Ranch Hand
Posts: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which three interfaces need to be declared in the web application descriptor?


So far there are 4 listeners related to the sessions.
Only three listeners can be there in Web deployment descriptor.
So what thing decides that HttpSessionListener cannot be declared in
the web.xml?

Do advice...
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Which three interfaces need to be declared in the web application descriptor?



Following are the different event listeners which can be configured to be used in a Web application:

Servlet Context Events
javax.servlet.ServletContextListener
javax.servlet.ServletContextAttributeListener

To receive notification events, the listener implementation class must be configured in the DD.


Request Events
javax.servlet.ServletRequestListener
javax.servlet.ServletRequestAttributeListener

To receive notification events, the listener implementation class must be configured in the DD.

Session Events
javax.servlet.http.HttpSessionListener
javax.servlet.http.HttpSessionAttributeListener
javax.servlet.http.HttpSessionBindingListener
javax.servlet.http.HttpSessionActivationListener

There's no need to configure the HttpSessionActivationListener and HttpSessionBindingListener implementation classes in the DD.

Regards,
 
Amandeep Singh
Ranch Hand
Posts: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks jaggi for reply,,,but now the question is So what thing decides that HttpSessionListener cannot be declared in
the web.xml?
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Amandeep Singh:
now the question is So what thing decides that HttpSessionListener cannot be declared in
the web.xml?


Whatever thing it is, it is not correct. A class implementing HttpSessionListener must be configured in web.xml. You must be confusing it with HttpSessionBindingListener.
From the Servlet spec SRV.15.1.7:

When an application stores an object in or removes an object from a session, the
session checks whether the object implements HttpSessionBindingListener
.
If it does, the servlet notifies the object that it has been bound to or unbound from
the session.


So there is no need to configure it in the deployment descriptor.
[ August 02, 2008: Message edited by: Irina Goble ]
 
Amandeep Singh
Ranch Hand
Posts: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh thanks Goble for the reply...
 
Hug your destiny! And hug 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