先引API
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>
确实认真查看过了,说的有“If namespace is null, this defaults to the current namespace”。但是实际情况如下:
<package name="banksystem" extends="struts-default" namespace="/">
<action name="regValidate" class="com.yulei.banksystem.action.validateAction.RegistValidate">
<result name="input">/regist.jsp</result>
<result type="chain">
<param name="actionName">regist</param>
<param name="namespace">/</param>
</result>
</action>
</package>
这样写不提示叉。
但是按照老写法或者参照文档里面那样的写法
<package name="banksystem" extends="struts-default">
<result type="chain">regist</result>
</package>
提示:
Multiple annotations found at this line:
- Undefined actionName parameter
- Undefined actionnamespace
parameter
问题不大,就是看着眼晕,不明白为什么默认是当前的命名空间,但是不写的话提示找不到命名空间.
------解决方案--------------------
如果 3 楼的方法还不行的话,再试试这个:
<package name="banksystem" extends="struts-default">
<result type="chain">/regist
<param name="actionName">regist</param>
<param name="nameSpace">/xxx</param> <!--regist 的 namespace-->
</result>
</package>
------解决方案--------------------
指定一个包空间。
------解决方案--------------------
指定一个namespace吧。。。