org.apache.struts2.views.gxp

## Class GxpResult

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

- All Implemented Interfaces:
    Serializable, Result

      public class GxpResult
      extends AbstractGxpResult

  Struts 2 GXP result type implementation. Outputs GXP. Pulls GXP parameters from Struts 2's value stack.

  Declare the GXP result type for your package in the xwork.xml file:

           <result-types>
             <result-type name="gxp" class="org.apache.struts2.views.gxp.GxpResult"/>
           </result-types>

  Or if you want to output XML instead of HTML:

           <result-types>
             <result-type name="gxp" class="org.apache.struts2.views.gxp.GxpResult">
               <param name="outputXml">true</param>
             </result-type>
           </result-types>

  Outputting XML changes the content type from text/html to application/xml and configures the `GxpContext` to output XML. This is useful in situations like specifying the doctype of your GXP to be 'mobile'.

  Use the GXP result type for the result of an action. For example:

         <result name="success" type="gxp">/myPackage/MyGxp.gxp</result>

  Author:
    Bob Lee
  See Also:
    `AbstractGxpResult`, Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.struts2.views.gxp.AbstractGxpResult

      `AbstractGxpResult.DefaultProvider, AbstractGxpResult.GxpResourceProvider`

    - ### Nested classes/interfaces inherited from interface com.opensymphony.xwork2.Result

      `Result.LegacyAdapter`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_PARAM` Tells Struts 2 which parameter name to use if it's not already specified.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GxpResult()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `execute(ActionInvocation invocation)` Tells the GXP to write itself to the output stream.
    `protected com.google.gxp.html.HtmlClosure` | `getGxpClosure()`
    `void` | `setContainer(Container container)`
    `void` | `setOutputXml(boolean outputXml)` Whether or not this GXP should output XML.

    - ### Methods inherited from class org.apache.struts2.views.gxp.AbstractGxpResult

      `getGxpName, getUseInstances, setGxpName, setUseInstances`

    - ### 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

      `adapt, execute`

- - ### Field Detail

    - #### DEFAULT_PARAM

          public static final String DEFAULT_PARAM

      Tells Struts 2 which parameter name to use if it's not already specified.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### GxpResult

          public GxpResult()

  - ### Method Detail

    - #### setOutputXml

          public void setOutputXml(boolean outputXml)

      Whether or not this GXP should output XML.
      Parameters:
        `outputXml` - set the output XML

    - #### getGxpClosure

          protected com.google.gxp.html.HtmlClosure getGxpClosure()

    - #### execute

          public void execute(ActionInvocation invocation)

      Tells the GXP to write itself to the output stream.
      Parameters:
        `invocation` - the action invocation

    - #### setContainer

          public void setContainer(Container container)

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