求助,No result defined for action的问题.
代码中只有一下内容可以正常运行:
struts.xml中
<action name="LogOn" method="showInput" class="usingtags.action.LogOn">
<result name="showInput">/UsingTags/logon.jsp</result>
</action>
LogOn.java中
public String showInput() {
return "showInput";
}
当加入以下内容时,就不能运行了:
struts.xml中
<action name="LogOn" method="doLogOn" class="usingtags.action.LogOn">
<result name="doLogOn">/UsingTags/welcome.jsp</result>
<result name="input">/UsingTags/logon.jsp</result>
</action>
LogOn.java中
public String doLogOn() {
if (UString.isInavildString(getTxLogName())) {
addFieldError("txLogName", "请输入用户名");
return "input";
}
System.out.println(UString.isInavildString(getTxLogName())+ getTxLogName());
if (UString.isInavildString(getTxPwd())) {
addFieldError("txPwd", "请输入密码");
return "input";
}
System.out.println(UString.isInavildString(getTxPwd()) + getTxPwd());
return "doLogOn";
}
jsp页面中:
<s:form action="LogOn!logOn">
<s:fielderror></s:fielderror>
<s:textfield name="txLogName" id="txLogName" label="用户名"></s:textfield>
<s:password name="txPwd" id="txPwd" label="密码"></s:password>
<s:submit value="登陆" label="登陆"></s:submit>
</s:form>
输入为空时提示错误:
HTTP Status 404 - No result defined for action usingtags.action.LogOn and result input
有输入时提示错误:
HTTP Status 404 - No result defined for action usingtags.action.LogOn and result doLogOn
result对应的页面都可以运行.
在网上搜了很长时间,有人提过这个问题,都没得到解决,难道就没有解决办法吗?
恳请高手帮忙!