日期:2014-05-17  浏览次数:20676 次

struts2访问老报404,大哥大姐叔叔阿姨伯伯婶婶们帮帮俺吧 ~(⊙o⊙)~
我有两个页面:add.jsp和list.jsp
现在是在add.jsp加入数据后跳入到list.jsp中,但是跳转的时候却显示404,找了半天也没找到原因
我的配置:
struts.xml:
<struts>
  <constant name="struts.ui.theme" value="simple"/>
  <constant name="struts.i18n.encoding" value="UTF-8"/>
<constant name="struts.action.extension" value="do"/>
<constant name="struts.serve.static.browserCache" value="false"/>
<constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
<package name="student" namespace="/student" extends="struts-default">
<action name="std_*" class="StdAction" method="{1}">
<result name="add">/pages/list.jsp</result>
</action>
</package>
</struts>

add.jsp页面:
<html>
<body>
<s:form action="/student/std_add.do">
姓 名:<s:textfield id="name"/><br>
性 别:<s:textfield id="gender"/><br>
入学日期:<s:textfield id="startDate"/><br>
<input type="submit" value="提交">
</s:form>
</body>
</html>
list.jsp页面:不写了

各位大侠剑客们,给小弟点意见吧! 谢谢......!!!!!!

------解决方案--------------------
报404的错都是路径写错了。。你在浏览器上写的路径贴出来看看,写路径的时候你有没有加上/student,比如这个路径:/student/std_add.action,你的web.xml改的是do吗,如果不行,你直接谢成espace="/"然后再重新调试,一般都可以的
------解决方案--------------------
改成这个试试看:namespace="/"
------解决方案--------------------
action也贴上来
------解决方案--------------------
form表单的跳转都不对,你都没有进入action啊!
------解决方案--------------------
<s:form action="/student/std_add.do">

改为student/std_add.do

<action name="std_*" class="StdAction" method="{1}">
里面的class=""的名字来自于spring配置文件里面的name (struts1) struts2为id的名字