The Application scope
getting an object that was placed in application scope (done in Struts Action):
In your Struts Action Class (inherits from org.apache.struts.action.Action) , like was done here just create the following method:
protected Object getApplicationObject(String attrName) {
return servlet.getServletContext().getAttribute(attrName);
}
setting an object into application scope can be done by implementing a struts plugin.
Create a class that extend org.apache.struts.action.PlugIn:
public class myPlugin implements org.apache.struts.action.PlugIn {
public void init(org.apache.struts.action.ActionServlet servlet,
ModuleConfig applicationConfig) throws ServletException {
setApplicationObject(servlet, "object1", "YES");
}
protected void setApplicationObject(
org.apache.struts.action.ActionServlet servlet, String attrName,
Object obj) {
ServletContext context = servlet.getServletContext();
context.setAttribute(attrName, obj);
}
}
Don’t forget to define your plugin in struts config file:
< plug-in className="myPath.myPlugin"/>
Lastly, remember the application scope is multithreaded



Hello webmaster
I would like to share with you a link to your site
write me here preonrelt@mail.ru
Hi! I was surfing and found your blog post… nice! I love your blog.
Cheers! Sandra. R.
Sign: umsun Hello!!! rcuwwymhyw and 12ssgfhphzye and 5620I will try to recommend this post to my friends and family, cuz its really helpful.