struts2 在jsp的from表单提交失效,不进入action
本帖最后由 ProgrammingPower 于 2013-09-22 13:02:17 编辑 from头如下
<form action="/MyApply/startFlow.action" method="post">
我一点提交 浏览器不进入struts2的action 而是在浏览器地址栏显示一行这个
http://localhost:8080/MyApply/itheima/customer/process/startFlow.jsp?courseId=1&username=%E6%9B%B9%E5%AE%87
http://localhost:8080/MyApply/itheima/customer/process/startFlow.jsp是我这个from所在JSP的路径
后面是我提交的两个属性 courseid username 可是怎么一点击提交 不进入action 反而感觉跟GET提交了
直接跑到了浏览器上面了呢? 求大神
代码如下
<form action="/MyApply/startFlow.action" method="post">
<table>
<tr>
<td width="130px" align="right" height="45px">请选择您的意向课程:</td>
<td>
<input type="radio" name="courseId" value="1" onBlur="checkCourse()">高数
<input type="radio" name="courseId" value="3" onBlur="checkCourse()">数据结构
<input type="radio" name="courseId" value="4" onBlur="checkCourse()">运筹学
<input type="hidden" name="username" value="${sessionScope.user.username}" />
<span id="s1" style="color: red;padding-left: 10px;"></span>
</td>
</tr>
<tr>
<td colspan="2" height="80px;">
<div style="background:url('../../images/customer/pic_button01.gif') no-repeat left top;width:110px; height:42px; padding-left:10px;">
<input type="submit" value="提交" style="outline:0 none; border:0 none; background:url('../../images/customer/pic_button01.gif') no-repeat right top;width:120px; height:42px;font-size:20px;color:#FFF;font-weight: bold;cursor:hand" />
</div>
</td>
</tr>
</table>
</form>
<package name="jbpm" namespace="/" extends="struts-default">
<action name="startFlow" class="com.my.apply.action.FlowAction" method="startFlow">
<result>/my/customer/process/applyIndex.jsp</result>
<result name="repeat">/repeat.jsp</result>
</action>
struts2 表单 jsp html
[解决办法]
namespace MyApply
[解决办法]
我记得访问应该是action name属性的值!方法名 不知道记错没!
[解决办法]
你form的action="/MyApply/startFlow.action"改成绝对路径action="http://localhost:8080/MyApply/startFlow.action"试试
[解决办法]
把/MyApply/startFlow.action写成startFlow.action 就行了 你structs 配置文件的Id是不是startFlow?
[解决办法]
你的nameapace 为/ , 把 MyApply 去掉试试
[解决办法]