• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ServletContextAttributeListener doesn't receive attributeRemoved() notification

 
Ranch Hand
Posts: 358
Firefox Browser Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 358
Firefox Browser Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 358
Firefox Browser Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic