下面是一个jsp代码,我要添加数据库,添加成功后,页面跳转到显示的页面,但添加成功后页面没跳转?
<divalign="center"><formaction="addIdServler"method="post"onsubmit="returnCheck()"><t...
<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> 展开
<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> 展开
2016-05-19
展开全部
那是因为,你没打跳回显示的页面代码:如,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>");
}
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>");
}
追问
我看一下,是否缺少这段代码,,,,,,,
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询