This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes ServletContext AttributeListener   behaviour Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Servlets
Bookmark "ServletContext AttributeListener   behaviour" Watch "ServletContext AttributeListener   behaviour" New topic

ServletContext AttributeListener behaviour

yogesh kalaskar

Joined: Sep 25, 2007
Posts: 8
when first request is made to the application the ServletContextListener invokes the
attributeAdded(ServletContextAttributeEvent sae) method with
sae.getName() returning org.apache.jasper.runtime.JspApplicationContextImpl
sae.getValue() = org.apache.jasper.runtime.JspApplicationContextImpl@5973ea

This happens before we programatically add any attribute in servlertContext.

i could not get what it is exactly. Please put focus onto it

Thanks in advance,
S Sravs
Ranch Hand

Joined: Feb 25, 2008
Posts: 85
i am using tomcat
* so in stdout log file i can get the attribute name which i declare in contextlistener class and the attribute value is toString
* Before you write servletcontextattributelistener class make sure that you had servletcontextlistenerclass
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

The container is using the context to set its own attributes, that's why the listener is being notified before you even try to add attributes yourself.

[My Blog]
All roads lead to JavaRanch
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: ServletContext AttributeListener behaviour
jQuery in Action, 3rd edition