您的位置:首页 > 其它

又遇No result defined for action org.action.AddAction and result success

2016-04-09 15:52 357 查看
No result defined for action org.action.AddAction and result success

遇到这个错误了

public String add() {
this.m_dResult=this.getA()+this.getB();
System.out.print(this.getA()+" "+this.getB()+" "+this.getResult());
return "add";
}


<struts>
<package name="default" extends="struts-default">
<action name="add" class="org.action.AddAction" method="add">
<result name="add">/output.jsp</result>
</action>
</package>
</struts>

4000
[/code]

更改为

public String add() {
this.m_dResult=this.getA()+this.getB();
System.out.print(this.getA()+" "+this.getB()+" "+this.getResult());
return "add";
}
public String execute() {
return add();
}


报错:No result defined for action org.action.AddAction and result add

最后的解决方案让我哭笑不得,我把add换成test,可以了

input.jsp

<form action="add.action" method="post">
<tr>
<td><input type="text" name="a"> </td>
<td>+</td>
<td><input type="text" name="b"></td>
<td><input type="submit" value="=">
</tr>
</form>


struts.xml

<action name="add" class="org.action.AddAction" method="execute">
<result name="success">/output.jsp</result>
</action>


我想可能是有些单词被用做其他的地方,导致解析时出了错
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: