请教: jsp 刷新后重复提交数据 jsp 保存到数据库后,跳到另一个页面,刷新这个页面数据会自动重复提交到数据库里 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <%@ page contentType="text/html;charset=GBK"%><%@ taglib prefix="ww" uri="/webwork"%><%@ page import="cn.gov.sgs.domain.UserInfo"%><%@page import="cn.gov.sgs.utils.HandleString"%><jsp:include page="../config_url.jsp" /><html> <head> <title>SGS绿色通道</title><link href="admin/style.css" rel="stylesheet"type="text/css" /></head><link rel="stylesheet" href="ud.css"><style type="text/css">body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px;}body,td,th { font-size: 12px; color: #000000;}a:link { color: #000000; text-decoration: none;}a:visited { color: #000000; text-decoration: none;}a:hover { color: #000000; text-decoration: none;}a:active { color: #000000; text-decoration: none; </style> <script type="text/javascript"> function deleteDengjiAppPledge(id) { if(confirm("是否删除?")){ location.href("/deleteDengjiAppPledge.action?id="+id); } } function add(etpsId,caseId) { location.href("/showDengjiAppPledge.action?etps.etpsId="+etpsId+"&caseId="+caseId); } function update(etpsId,caseId,id){ location.href("/turnDengjiAppPledge.action?etps.etpsId="+etpsId+"&caseId="+caseId+"&Id="+id); } function remove(etpsId,caseId,id){ if(confirm("是否删除?")){ document.getElementById('id').value=id; location.href("/deleteDengjiAppPledge.action?etps.etpsId="+etpsId+"&caseId="+caseId+"&id="+id); } } function chooseinfo(etpsId,caseId){ location.href("/turnChooseInfo.action?etps.etpsId="+etpsId+"&caseId="+caseId); } function aa(){ alert("111"); } </script> <% String caseId = request.getParameter("caseId"); %> <body > <%@include file="header.jsp"%> <form name="form"> <input type="hidden" name="etps.etpsId" value="<ww:property value="etps.etpsId"/>"> <input type="hidden" name="dengjiAppPledg.case_id" value="<%=caseId%>"> <input type="hidden" name="dengjiAppPledge.id" id="id" value="<ww:property value="dengjiAppPledge.id"/>"> <table border="0" cellpadding="0" cellspacing="0" width="700" align="center"> <tr align=center> <td> <p class="h01" align="center"> 外商投资的公司股权质押备案所需提交的信息 </p> </td> </tr> <tr> <td> </td> </tr> <tr align="left"> <td> <p class="p01" align="left"> 企业名称: <b><ww:property value="etps.etpsName" /></b> </p> </td> </tr> </table> <table width="700" align="center" border=1 cellpadding="3" cellspacing="0" class="p01"> <tr> <td colspan=2> [ <font color=red><a href="javascript:add('<ww:property value="etps.etpsId"/>','<ww:property value="caseId"/>')"> 增加</a> </font> ] </td> </tr> <tr> <td colspan=4> <table width=690 border="0" align="center" cellpadding="0" cellspacing="1" class="list-boder"> <tr> <td> <table width=700 border=0 style="border-collapse: collapse" bordercolor=black align=center cellpadding=5 cellspacing=1> <tr align="center"> <td width="5%" >序号</td> <td width="30%" >出质股东名称/姓名</td> <td width="20%" >质权人名称</td> <td width="20%" >所占比例</td> <td width="20%" >操作</td> </tr> <ww:iterator value="list"> <tr class="input-td2" align="center"> <td ><ww:property value="id" /></td> <td><ww:property value="entity_name" /></td> <td><ww:property value="creditor_name" /></td> <td><ww:property value="percent" /><font color=red>%</font></td> <td align="center"><a href="javascript:remove('<ww:property value="etps.etpsId"/>','<ww:property value="caseId"/>','<ww:property value="id" />')">删除</a> <a href="javascript:update('<ww:property value="etps.etpsId"/>','<ww:property value="caseId"/>','<ww:property value="id" />')">修改</a></td> </tr> </ww:iterator> </table> </td> </tr> </table> </td> </tr> </table> </form> <p></p> <p></p> <table width="400" align="center"> <tr> <td width="145" class="p01"></td> <td> <input type="button" name="button" value=" 返 回 " onclick="location.href='/turnChooseInfo.action?etps.etpsId=<ww:property value="etps.etpsId"/>&caseId=<ww:property value="caseId"/>'"> </td> </tr> </table> <%@include file="footer.jsp"%> </body></html>请看看 这个页面好像没有新增的按钮。我想应该是这个原因:可能是你的新增页面提交表单,程序处理后,不是通过重定向到当前的显示页面。而是通过请求转发到达这个页面的。如果这样做的话,原来的请求参数仍在request中保存。所以一旦刷新数据就会再添加一次。改正的方法就是,在你添加完成后,实用重定向到当前的显示页面。这只是我个人大胆的猜想。 不会的,如果是用表单提交,request的保存时间只是一次提交提交内,再刷新request的值应该是空了,不可能会再入库一次的,应该不是这个原因,我原先做的页面不用重定向,他也不会说刷新一次就提交啊 刷新也就是重新编译了一次jsp,怀疑lz哪多谢了提交入库的操作,<jsp:include page="../config_url.jsp" /> 动态加载的这个jsp干什么用的? <jsp:include page="../config_url.jsp" /> 这个是引用地一个路径美工用的 用response.sendRedirect()这个试一试。 求助,这样算不算是HardCode 小菜疑惑 大神求助 groovyWS的new WSClient()问题 关于 几个 日期 和 字符串 操作的问题 ????/ hql语句书写 方法"from Comment c where c.assetId='"+assetId+"' and c.status='"+status+" 在JFrame中怎样实现平滑的文字滚动? 请教! 求素数 散分 请教Quartz中任务执行时间表达式的配置问题!! 我要画图文件方法的运用 一个map的小问题??? 怎样根据条件取消正在执行的TimeTask(续)?
<%@ taglib prefix="ww" uri="/webwork"%>
<%@ page import="cn.gov.sgs.domain.UserInfo"%>
<%@page import="cn.gov.sgs.utils.HandleString"%>
<jsp:include page="../config_url.jsp" />
<html> <head>
<title>SGS绿色通道</title>
<link href="admin/style.css" rel="stylesheet"type="text/css" /></head><link rel="stylesheet" href="ud.css"><style type="text/css">body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px;}body,td,th { font-size: 12px; color: #000000;}a:link { color: #000000; text-decoration: none;}a:visited { color: #000000; text-decoration: none;}a:hover { color: #000000; text-decoration: none;}a:active { color: #000000; text-decoration: none; </style> <script type="text/javascript">
function deleteDengjiAppPledge(id)
{
if(confirm("是否删除?")){
location.href("/deleteDengjiAppPledge.action?id="+id);
}
}
function add(etpsId,caseId)
{
location.href("/showDengjiAppPledge.action?etps.etpsId="+etpsId+"&caseId="+caseId);
}
function update(etpsId,caseId,id){
location.href("/turnDengjiAppPledge.action?etps.etpsId="+etpsId+"&caseId="+caseId+"&Id="+id);
}
function remove(etpsId,caseId,id){ if(confirm("是否删除?")){
document.getElementById('id').value=id;
location.href("/deleteDengjiAppPledge.action?etps.etpsId="+etpsId+"&caseId="+caseId+"&id="+id); }
}
function chooseinfo(etpsId,caseId){ location.href("/turnChooseInfo.action?etps.etpsId="+etpsId+"&caseId="+caseId);
}
function aa(){ alert("111");
}
</script>
<%
String caseId = request.getParameter("caseId");
%> <body > <%@include file="header.jsp"%>
<form name="form"> <input type="hidden" name="etps.etpsId"
value="<ww:property value="etps.etpsId"/>">
<input type="hidden" name="dengjiAppPledg.case_id"
value="<%=caseId%>">
<input type="hidden" name="dengjiAppPledge.id" id="id"
value="<ww:property value="dengjiAppPledge.id"/>"> <table border="0" cellpadding="0" cellspacing="0" width="700"
align="center">
<tr align=center>
<td>
<p class="h01" align="center">
外商投资的公司股权质押备案所需提交的信息
</p>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr align="left">
<td>
<p class="p01" align="left">
企业名称:
<b><ww:property value="etps.etpsName" /></b>
</p>
</td>
</tr>
</table> <table width="700" align="center" border=1 cellpadding="3"
cellspacing="0" class="p01">
<tr>
<td colspan=2>
[
<font color=red><a href="javascript:add('<ww:property value="etps.etpsId"/>','<ww:property value="caseId"/>')"> 增加</a>
</font> ]
</td>
</tr>
<tr>
<td colspan=4>
<table width=690 border="0" align="center" cellpadding="0" cellspacing="1" class="list-boder">
<tr>
<td>
<table width=700 border=0 style="border-collapse: collapse" bordercolor=black align=center cellpadding=5 cellspacing=1>
<tr align="center">
<td width="5%" >序号</td>
<td width="30%" >出质股东名称/姓名</td>
<td width="20%" >质权人名称</td>
<td width="20%" >所占比例</td>
<td width="20%" >操作</td>
</tr>
<ww:iterator value="list">
<tr class="input-td2" align="center">
<td ><ww:property value="id" /></td>
<td><ww:property value="entity_name" /></td>
<td><ww:property value="creditor_name" /></td>
<td><ww:property value="percent" /><font color=red>%</font></td>
<td align="center"><a href="javascript:remove('<ww:property value="etps.etpsId"/>','<ww:property value="caseId"/>','<ww:property value="id" />')">删除</a> <a href="javascript:update('<ww:property value="etps.etpsId"/>','<ww:property value="caseId"/>','<ww:property value="id" />')">修改</a></td>
</tr>
</ww:iterator>
</table>
</td>
</tr>
</table>
</td>
</tr> </table>
</form>
<p></p>
<p></p>
<table width="400" align="center">
<tr>
<td width="145" class="p01"></td>
<td>
<input type="button" name="button" value=" 返 回 "
onclick="location.href='/turnChooseInfo.action?etps.etpsId=<ww:property value="etps.etpsId"/>&caseId=<ww:property value="caseId"/>'">
</td>
</tr>
</table> <%@include file="footer.jsp"%>
</body>
</html>
请看看
可能是你的新增页面提交表单,程序处理后,不是通过重定向到当前的显示页面。
而是通过请求转发到达这个页面的。如果这样做的话,原来的请求参数仍在request中保存。
所以一旦刷新数据就会再添加一次。
改正的方法就是,在你添加完成后,实用重定向到当前的显示页面。这只是我个人大胆的猜想。
动态加载的这个jsp干什么用的?
这个是引用地一个路径美工用的