This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Order of notification for listeners Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Order of notification for listeners" Watch "Order of notification for listeners" New topic
Author

Order of notification for listeners

Devang Ganatra
Greenhorn

Joined: Feb 19, 2008
Posts: 5
Hello
I want to know that in which order the registere listeners will be notified. Means suppose i have registered ServletContextListener,ServletRequestListener,HttpSessionListener then in which order they will be called by container?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

They are called when the appropriate event occurs. ServletContextListener reacts to changes in the servlet context og the applciation (e.g. Servlet initialisation). ServletRequestListener reacts to requests. HttpSessionListener reacts to session creation/deletion events.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Devang Ganatra
Greenhorn

Joined: Feb 19, 2008
Posts: 5
Thanks for your reply..

So if i have registered
ServletContextListener ,HttpSessionListener,ServletRequestListener then first ServletContextListener will be called, second ServletRequestWill be called , and last HttpSessionListener will be called right?? please correct me if i am wrong.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
As already mentioned the listener is called when the appropriate event occurs. So, obviously a servlet context event listener will be called before a servlet request or session event listeners.
[ September 29, 2008: Message edited by: Bosun Bello ]

Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Order of notification for listeners
 
Similar Threads
order of listeners
Order of listeners
event order guarantee?
Listeners
order in which listeners are called