• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletContext AttributeListener behaviour

 
yogesh kalaskar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
and
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,
Yogesh
 
S Sravs
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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é
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic