HTTP Status 404 - No result defined for action actions.studentRegisterAction and result input
type Status report
message No result defined for action actions.studentRegisterAction and result input
description The requested resource is not available.
Apache Tomcat/6.0.36
原因原来是
<s:form action="studentInfoShow" namespace="/test">
<s:textfield label="姓名" name="studentName"></s:textfield>
<s:textfield label="学号" name="studentName"></s:textfield>
<s:textfield label="年龄" name="studentName"></s:textfield>.
<s:submit value="提交" align="center"></s:submit>
</s:form>
看到了吗,姓名,学号年龄的name竟然写成一样的了,粗心啊,当初复制粘贴忘记改了!
修改了之后再重新测试,发现还是错了,依旧是
No result defined for action actions.studentRegisterAction and result input
为什么会这样呢?
这个时候我发现在类中我定义的sage是int型的,然而传值的时候是不会将string 类型的转换为int型的,于是我把sage改成了String类型的,然后重新测试,这下应该没有问题了吧。
然而并没有!!!!!!!依然是这个错误!!!
于是我察看了struts.xml,
<struts>
<package name="default" namespace="/test" extends="struts-default">
<action name="studentRegisterAction">
<result name="success">/studentInfoCollector.jsp </result>
</action>
<action name="studentInfoShow" class="actions.studentRegisterAction">
<result name="success">/studentInfoShow.jsp</result>
<result name="fail">/index.jsp</result>
</action>
</package>
</struts>
<package name="default" namespace="/test" extends="struts-default">
<action name="studentRegisterAction">
<result name="success">/studentInfoCollector.jsp </result>
</action>
<action name="studentInfoShow" class="actions.studentRegisterAction">
<result name="success">/studentInfoShow.jsp</result>
<result name="fail">/index.jsp</result>
</action>
</package>
</struts>
发现问题了么?把fail改成input就行了,OK,终于成功了!!