org.apache.struts2.views.gxp

## Class AbstractGxpResult

- java.lang.Object
- - org.apache.struts2.views.gxp.AbstractGxpResult

- All Implemented Interfaces:
    Result, Serializable
  Direct Known Subclasses:
    GxpResult

      public abstract class AbstractGxpResult
      extends 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 use`useInstances` 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

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `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

    Constructors
    Constructor and Description
    `AbstractGxpResult()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected String` | `getGxpName()`
    `protected boolean` | `getUseInstances()`
    `void` | `setGxpName(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(String gxpName)

    - #### getGxpName

          protected final String getGxpName()

    - #### setUseInstances

          public void setUseInstances(boolean useInstances)

    - #### getUseInstances

          protected final boolean getUseInstances()

Copyright © 2000–2022 Apache Software Foundation. All rights reserved.