TechnoBuzz

A Techno Blog, mainly about Java

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

October 27, 2005 Posted by | Struts | 3 Comments

Yahoo Blog Search

Link: Apple Introduces Video IPod, TV Deals – Yahoo! News.

October 24, 2005 Posted by | Blogging | Leave a comment

RSS tips, links

link

blog purchase

test driven

effective java

more ajax

October 21, 2005 Posted by | Blogging | Leave a comment

AJAX Demos

Relevance has Demo from Ajax presentation at Java in Action .

October 18, 2005 Posted by | Web Design | Leave a comment

link dump

You said AJAX . [l]

How about UML

JBOSS has issues?

Java news

jgoodies

Need a conversion?

whats in that jar

lost that number

October 14, 2005 Posted by | J2EE | Leave a comment

Yahoo! Podcasts

Link: Yahoo! Podcasts.

October 13, 2005 Posted by | Blogging | Leave a comment

Eclipse donation

Link: developerWorks : Blogs : Bob Sutor.

October 13, 2005 Posted by | Open Source | Leave a comment

Java theory and practice: Urban performance legends, revisited

Link: Java theory and practice: Urban performance legends, revisited.

October 11, 2005 Posted by | J2EE | Leave a comment

Serial version

Link: developerWorks : Blogs : Bobby Woolf.

October 11, 2005 Posted by | J2EE | Leave a comment

Miers

Link: The Left Coaster: Who is Harriet Miers?.

October 5, 2005 Posted by | Current Affairs | Leave a comment

RSS News (archive)

Link: Latest RSS News (RSS Info).

October 2, 2005 Posted by | Weblogs | Leave a comment

Data Access Object

Link: Dazed & Confused.

October 2, 2005 Posted by | Hibernate & ORM | Leave a comment