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:
- Implement
execute(ActionInvocation)
, which must instruct the GXP to write itself to the output stream. See {@link GxpResult} for asample implementation. - 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 {@code Interface}), you can set the use {@code useInstances} parameter to{@code 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 {@code Interface}using the {@link com.opensymphony.xwork2.ObjectFactory}. If {@link com.google.webwork.GuiceWebWorkIntegrationModule} is installed, or{@link com.google.webwork.ContainerObjectFactory} is set as the static{@code ObjectFactory} instance, then Guice will be used to instantiate theGXP instance; otherwise, only GXPs with no constructor parameters will work.
@author Bob Lee