Struts2 没有为操作iland.login.LOGINATION和结果AddBill定义结果

Struts2 没有为操作iland.login.LOGINATION和结果AddBill定义结果,struts2,Struts2,我得到了以下例外 SEVERE: Exception occurred during processing request: No result defined for action iland.login.LoginAction and result AddBill No result defined for action iland.login.LoginAction and result AddBill 这里有两个基于角色值的操作,我想将其重定向到相应的操作 在行动中: if (

我得到了以下例外

SEVERE: Exception occurred during processing request: No result defined for action iland.login.LoginAction and result AddBill
    No result defined for action iland.login.LoginAction and result AddBill
这里有两个基于角色值的操作,我想将其重定向到相应的操作

在行动中:

if (role > 3) {
                return "dashboard";
            } else if (role <= 3) {
                return "AddBill";
            }
if(角色>3){
返回“仪表板”;

}else if(role您必须始终返回
结果

使用重定向操作
结果类型,
结果
可以映射到另一个
操作
。不能通过返回操作名称来调用操作

你需要这个:

直接来自操作的结果界面的

返回新的ServletActionRedirectResult(“AddBill”);

错误清楚地表明您没有
AddBill
结果。添加一个。在操作中,我包含了
AddBill
dashboard
这些不是结果,而是操作。我尝试了
/pages/dashboadr.jsp
,但如果我们编写
AddBill
,则会显示相同的错误,这将重定向到
AddBill
操作打开。那么,为了纠正常见错误,这里可能会出现什么问题?您始终可以直接从操作返回
结果
接口的实例。它没有文档记录,但可以正常工作-下一版本的文档将包含关于此问题的说明
<action name="login" class="iland.login.LoginAction" method="doLogin">
            <result name="success" type="redirect">${url}</result>
            <result name="input">/pages/login.jsp</result>
        </action>
        <action name="dashboard" class="iland.login.DashBoardAction" method="fetch">
            <result name="success">/pages/dashboadr.jsp</result>
            <result name="input">/pages/dashboadr.jsp</result>
            <result name="login">/pages/login.jsp</result>
        </action>
 <action name="AddBill"  class="iland.login.LoginForPage">
            <result name="success">/pages/billing/AddBill.jsp</result>
            <result name="input">/pages/billing/AddBill.jsp</result>
            <result name="login">/pages/login.jsp</result>
        </action>