Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ chapter 5 doubt , Please help..

 
Vishal Chugh
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am confused about below : ( from chapter 5 of HFSJ)

Why we required ServletContextListner ( as we used for Dog example in book) if we could use dog as context attribute also ?
OR
Both will serve the same purpose ?

[for sure if we use it as context attribute , then it will have threading issue ], what other reasons could be?

Please help.

Thanks
Vishal Chugh
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ServletContextListener - Use this listener when you want to get notifications for ServletContext Created and servlet context destroyed.

ServletContextAttributeListener - Use this listener when you want to get notifications for when any code adds/remove/replaces an attribute to servlet context via ServletContext.addAttribute() or ServletContext.removeAttribute()

Both are completely different. I will suggest you to try few examples and you will know the difference.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic