Versions Compared

Key

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

Overview

WebWork provides the ability to chain multiple actions into a defined sequence or workflow. This feature works by applying a Chain Result to source a given action, that needs its state propagated to and intercepting its target action. The code excerpt below show hos this can be done. 's invocation with a ChainingInterceptor.

Chain Result

Code Block
xml
xml
<!-- simple chain example to an action in same namespace ->
<result name="success" type="chain">
    <param name="actionName">Bar</param>
</result>

<!- example of chaining to an action in a different namespace/package -->
<result name="success" type="chain">
	<param name="actionName">viewFoo</param>
	<param name="namespace">/foo</param>
</result>	

Another Action in the same namespace (or the default "" namespace) can be executed after this Action (see Configuration). An optional "namespace" parameter may also be added to specify an Action in a different namespace. The original parameters from the request and the ValueStack are passed in when this Action is chained to, so the chained to Action will be added on the ValueStack above the chained from Action. This allows the chained to Action to access the properties of the preceding Action(s) using the ValueStack, and also makes these properties available to the final result of the chain, such as the JSP or Velocity page.

Chaining Interceptor

However, this is only half of the equation. In order for the chain result to

If you need to copy the properties from your previous Actions in the chain to the current Action, you should apply the ChainingInterceptor which copies the properties of all objects on the ValueStack to the current target.

...