Hi,

We are considering deprecating action chaining and removing it in a
future major release. This covers the "chain" result type
(org.apache.struts2.result.ActionChainResult), the "chain" interceptor
(org.apache.struts2.interceptor.ChainingInterceptor) that copies the
previous action's properties onto the next one, and the Unchainable
marker interface.

Action chaining has been documented as "not recommended" for a long
time. It runs a second action inside the first request with its own
interceptor stack, shares the value stack between the two actions, and
copies action properties by name, which makes the flow of data between
them hard to follow and hard to secure. The alternatives cover the usual
cases:
- the "redirectAction" result (Redirect After Post), which sends the
browser to the next action and keeps each request to one action
- moving the shared logic into a service or a base class that both
actions call directly
- ScopedModelDriven or the session, where state has to survive between
the two steps

One thing to check if you use the Convention plugin: it chains
implicitly. When an action "foo" returns a result code "bar" and no
result is configured for it, and an action named "foo-bar" exists in the
same package, the plugin builds a chain result to it. You may be relying
on chaining without a <result type="chain"> anywhere in your
configuration.

Before we decide, we would like to know whether anyone still relies on
action chaining. If you use it, please reply and tell us what you use it
for, especially if the alternatives above would not work for you.

Thanks in advance!
Lukasz

Reply via email to