刷新页面为何会无缘无故的自动拷贝一条记录?
刷新时浏览器有个提示如下
The page cannot be refreshed without resending the infoemation.
Click Retry to send the information again,
or Click Cancel to return to the page that you were trying to view
点retry就多了一条记录?这是怎么回事?怎么修改?
刷新时浏览器有个提示如下
The page cannot be refreshed without resending the infoemation.
Click Retry to send the information again,
or Click Cancel to return to the page that you were trying to view
点retry就多了一条记录?这是怎么回事?怎么修改?
<script language="javascript">
var checkSubmitFlg = false;
function checkSubmit() {
if (checkSubmitFlg == true) {
return false;
}
checkSubmitFlg = true;
return true;
}
document.ondblclick = function docondblclick() {
window.event.returnValue = false;
}
document.onclick = function doconclick() {
if (checkSubmitFlg) {
window.event.returnValue = false;
}
}
</script>
<html:form action="myAction.do" method="post" onsubmit="return checkSubmit();">
所以刷新后又会生成一条记录,应该是这个问题。楼上的方法不行啊,刷新时没通过那个提交按钮所触发的js,而是直接传到后台的action里
解决方法2:在提交表单,插入数据以后,使用redirect跳转