• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

ServletContextAttributeListener doesn't receive attributeRemoved() notification  RSS feed

 
Ranch Hand
Posts: 355
Chrome Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've the following ServletContextAttributeListener:


And here is my servlet:


The last line of doGet() removes an attribute. But, MyContextAttributeListener is not notified about this event. Why?
 
Ranch Hand
Posts: 47
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Faisal Ahmad wrote:The last line of doGet() removes an attribute. But, MyContextAttributeListener is not notified about this event. Why?



It has a Typo mistake. Notice the getSerlvetContext instead of getServletContext.

your last line of doGet is :



It should be :



You should get compilation error for this.

Regards,
Niraj
 
Faisal Ahmad
Ranch Hand
Posts: 355
Chrome Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot lot Niraj! I overlooked the compilation error. How silly!
 
Niiraj Patel
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Faisal,

While preparing for exam, the best practice is the Notepad.

Please manually compile and deploy classes.

Regards,
Niraj
 
Faisal Ahmad
Ranch Hand
Posts: 355
Chrome Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you are right. I use a better notepad - TextPad. However, I am using a batch script (make.bat) that I wrote exclusively for practicing exercises. Unfortunately, it lacks the mechanism to stop upon compilation error. I just overlooked the error. I'll have to modify the script.

Thanks again!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!