org.apache.struts2.views.gxp
Class AbstractGxpResult

java.lang.Object
  extended by org.apache.struts2.views.gxp.AbstractGxpResult
All Implemented Interfaces:
Result, java.io.Serializable
Direct Known Subclasses:
GxpResult

public abstract class AbstractGxpResult
extends java.lang.Object
implements Result

The abstract base class for our Struts 2 GXP result type implementation. It outputs GXP, and pulls GXP parameters from Struts 2's value stack. Implementing classes have to:

  1. Implement execute(ActionInvocation), which must instruct the GXP to write itself to the output stream. See GxpResult for a sample implementation.
  2. Add a public static final field DEFAULT_PARAM with the value 'gxpName'. Struts 2 needs this to set the name of your template into this object.

If you want to use instantiated GXPs (using the nested Interface), you can set the useuseInstances parameter to true:

     <result-types>
       <result-type name="gxp" class="org.apache.struts2.views.gxp.GxpResult">
         <param name="useInstances">true</param>
       </result-type>
     </result-types>
 
This means that Struts 2 will attempt to instantiate the Interface using the ObjectFactory. If com.google.webwork.GuiceWebWorkIntegrationModule is installed, or com.google.webwork.ContainerObjectFactory is set as the static ObjectFactory instance, then Guice will be used to instantiate the GXP instance; otherwise, only GXPs with no constructor parameters will work.

Author:
Bob Lee
See Also:
Serialized Form

Nested Class Summary
protected static class AbstractGxpResult.DefaultProvider
          Uses reasonable defaults to provide resources.
protected static interface AbstractGxpResult.GxpResourceProvider
          Provides resources necessary to execute a GXP.
 
Constructor Summary
AbstractGxpResult()
           
 
Method Summary
protected  java.lang.String getGxpName()
           
protected  boolean getUseInstances()
           
 void setGxpName(java.lang.String gxpName)
           
 void setUseInstances(boolean useInstances)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.opensymphony.xwork2.Result
execute
 

Constructor Detail

AbstractGxpResult

public AbstractGxpResult()
Method Detail

setGxpName

public void setGxpName(java.lang.String gxpName)

getGxpName

protected final java.lang.String getGxpName()

setUseInstances

public void setUseInstances(boolean useInstances)

getUseInstances

protected final boolean getUseInstances()


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.