Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment:

Update formatting

Overview

WebWork The framework provides the ability to chain multiple actions into a defined sequence or workflow. This feature works by applying a Chain Result to a given actionAction, and intercepting its target actionAction's invocation with a ChainingInterceptor.

Warningtip
titleWarningDon't Try This at Home

As a ruleIn general, Action Chaining is not recommended. However, there are First explore other options, such as the Redirect After Post technique.

...

The Chain Result is a result type that invokes an action Action with its own interceptor stack Interceptor Stack and resultResult. This Interceptor allows an action Action to forward requests to a target actionAction, while propagating the state of the source actionAction. Below is an example of how to define this sequence.

Wiki Markup
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork.ActionChainResult}

Another action mapping in the same namespace (or the default "" namespace) can be executed after this action mapping (see Configuration Files). An optional "namespace" parameter may also be added to specify an action in a different namespace.

...

If you need to copy the properties from your previous Actions in the chain to the current action, you should apply the ChainingInterceptor. The interceptor Interceptor will copy the original parameters from the request, and the ValueStack is passed in to the target actionAction. The source action Action is remembered by the ValueStack, allowing the target action Action to access the properties of the preceding actionAction(s) using the ValueStack, and also makes these properties available to the final result of the chain, such as the JSP or Velocity page.

One common use of action Action chaining is to provide lookup lists (like for a dropdown list of states, etc). Since these actions Actions get put on the ValueStack, these their properties will be available in the view. This functionality can also be done using the ActionTag to execute an action Action from the display page. You may also use the Redirect Action Result to accomplish this.