下面是一个jsp代码,我要添加数据库,添加成功后,页面跳转到显示的页面,但添加成功后页面没跳转?

<div align="center">
<form action="addIdServler" method="post" onsubmit="return Check()">
<table width="296" border="1">
<tr>
<td colspan="2"><div align="center">添加人员</div>
</td>
</tr>
<tr style="background-color:rgb(219,241,212);">
<td width="88">姓名:</td>
<td width="192"><input type="text" name="name" />
</td>
</tr>
<tr>
<td>性别:</td>
<td><select name="sex">
<option value="0">请选择</option>
<option value="男">男</option>
<option value="女">女</option>
</select>
</td>
</tr>
/table>
</form>
</div>

那是因为,你没打跳回显示的页面代码:如,info.setnAME(request.getParameter("name"));
info.setsEX(request.getParameter("sex"));
info.setaGE(Integer.valueOf(request.getParameter("age")));
info.setrANK(request.getParameter("rank"));
info.setdEPARTMENT(request.getParameter("department"));
int count=infoImple.InsertInfo(info);
if (count>0) {
out.println("<script>");
out.println("alert(添加成功)");
out.println("location.href='getHrinfoServlte';");
out.println("</script>");
}else {
out.println("<script>");
out.println("alert(添加失败)");
out.println("</script>");
}追问

我看一下,是否缺少这段代码,,,,,,,

温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答