org.apache.struts2.result

## Class ActionChainResult

- java.lang.Object
- - org.apache.struts2.result.ActionChainResult

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

      public class ActionChainResult
      extends Object
      implements Result

  This result invokes an entire other action, complete with it's own interceptor stack and result. This result type takes the following parameters:
  - actionName (default) - the name of the action that will be chained to
  - namespace - used to determine which namespace the Action is in that we're chaining. If namespace is null, this defaults to the current namespace
  - method - used to specify another method on target action to be invoked. If null, this defaults to execute method
  - skipActions - (optional) the list of comma separated action names for the actions that could be chained to
  Example:

       <package name="public" extends="struts-default">
           <!-- Chain creatAccount to login, using the default parameter -->
           <action name="createAccount" class="...">
               <result type="chain">login</result>
           </action>

           <action name="login" class="...">
               <!-- Chain to another namespace -->
               <result type="chain">
                   <param name="actionName">dashboard</param>
                   <param name="namespace">/secure</param>
               </result>
           </action>
       </package>

       <package name="secure" extends="struts-default" namespace="/secure">
           <action name="dashboard" class="...">
               <result>dashboard.jsp</result>
           </action>
       </package>

  Author:
    Alexandru Popescu
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### 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` The result parameter name to set the name of the action to chain to.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ActionChainResult()`
    `ActionChainResult(String namespace, String actionName, String methodName)`
    `ActionChainResult(String namespace, String actionName, String methodName, String skipActions)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `void` | `execute(ActionInvocation invocation)`
    `static LinkedList<String>` | `getChainHistory()` Get the XWork chain history.
    `ActionProxy` | `getProxy()`
    `int` | `hashCode()`
    `void` | `setActionName(String actionName)` Set the action name.
    `void` | `setActionProxyFactory(ActionProxyFactory actionProxyFactory)`
    `void` | `setMethod(String method)`
    `void` | `setNamespace(String namespace)` sets the namespace of the Action that we're chaining to.
    `void` | `setSkipActions(String actions)` Set the list of actions to skip.
    `protected String` | `translateVariables(String text)`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, 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

      The result parameter name to set the name of the action to chain to.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ActionChainResult

          public ActionChainResult()

    - #### ActionChainResult

          public ActionChainResult(String namespace,
                                   String actionName,
                                   String methodName)

    - #### ActionChainResult

          public ActionChainResult(String namespace,
                                   String actionName,
                                   String methodName,
                                   String skipActions)

  - ### Method Detail

    - #### setActionProxyFactory

          public void setActionProxyFactory(ActionProxyFactory actionProxyFactory)

      Parameters:
        `actionProxyFactory` - the actionProxyFactory to set

    - #### setActionName

          public void setActionName(String actionName)

      Set the action name.
      Parameters:
        `actionName` - The action name.

    - #### setNamespace

          public void setNamespace(String namespace)

      sets the namespace of the Action that we're chaining to. if namespace is null, this defaults to the current namespace.
      Parameters:
        `namespace` - the name of the namespace we're chaining to

    - #### setSkipActions

          public void setSkipActions(String actions)

      Set the list of actions to skip. To test if an action should not throe an infinite recursion, only the action name is used, not the namespace.
      Parameters:
        `actions` - The list of action name separated by a white space.

    - #### setMethod

          public void setMethod(String method)

    - #### getProxy

          public ActionProxy getProxy()

    - #### getChainHistory

          public static LinkedList<String> getChainHistory()

      Get the XWork chain history. The stack is a list of `namespace/action!method` keys.
      Returns:
        the chain history as string list

    - #### execute

          public void execute(ActionInvocation invocation)
                       throws Exception

      Parameters:
        `invocation` - the DefaultActionInvocation calling the action call stack
      Throws:
        `Exception`

    - #### translateVariables

          protected String translateVariables(String text)

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

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