Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.13, 2.1.2
-
None
Description
If I invoke an action from a JSP with <s:action..>, that action will get actionErrors copied from the first action.
This is done by ChainingInterceptor, unless the first action implements Unchainable.
Actions included with <s:action..> should be independent of the page they are included from, this is not the same as using resultType 'chain'.
Example:
FooAction:
public class FooAction extends ActionSupport {
public String execute()
}
foo.jsp:
<s:action name="bar"/>
BarAction:
public class BarAction extends ActionSupport{
}
struts.xml:
<action name="foo" class="test.FooAction">
<result>/jsp/foo.jsp</result>
</action>
<action name="bar" class="test.BarAction">
<result>/jsp/bar.jsp</result>
</action>
When going to /foo.action then BarAction is never invoked because:
1) FooAction adds actionError
2) foo.jsp is displayed
3) foo.jsp invokes BarAction with <s:action..> tag
4) ChainingInterceptor intercepts BarAction and copies actionErrors from FooAction to BarAction
5) DefaultWorkflowInterceptor intercepts BarAction and since BarAction now has actionErrors, it stops the invocation and returns "input"
6) There is no "input" result defined for BarAction, which leads to Exception
This is the line in ChainingInterceptor that copies the actionErrors:
reflectionProvider.copy(o, invocation.getAction(), ctxMap, excludes, includes);
This shouldn't be done in the case of a <s:action..>, only for resultType 'chain'
I have verified that this is still an issue in the latest svn version of 2.1.3 (rev 701674).