HTML部分代码,需要将input中的id为dutyType的value传到后台
<form action="do?module=User&action=Login&method=chooseWS" method="post" id="textForm"></form>
<table onclick="chooseWS();">
<tr>
<td>
<input type="hidden" name="dutyType" id="dutyType" value="111"/>
</td>
</tr>
</table>
js部分代码:
function chooseWS(){
var form = document.getElementById(dutyType);//获取表单数据
form.action = form.action+"&dutyType="+$("#dutyType").val();
$("#testForm").submit();
}
说明:由与是公司的自己的框架,需要说明的是html代码中的action的method=chooseWS是后台需要执行的方法,在java中接收的参数名就是dutyType
public void chooseWS() {
String dutyType = getParameter("dutyType");//获取前台dutyType的值
//根据dutyType的值选择页面跳转的具体地址
if("SS".equals(dutyType)) {
forward( "declarer/project.jsp");//申办方
}else if("GO".equals(dutyType)) {
forward("organization/project.jsp");//机构办公室
}else if("PG".equals(dutyType)) {
forward( "manager/project.jsp");
}else if("IRB".equals(dutyType)) {
//forward("patient/enroll.jsp");/伦理办公室
}
}