日期:2014-05-16  浏览次数:20401 次

防刷新重复提交 action配置(防乱码) js防刷

1. 现象:在我们系统中,新增、编辑数据后,继续刷新页面后,会出现重复提交的现象
2. 原因及解决方案:我们在设置action跳转的时候,将跳转方式设置成了type="chain"的方式,
?? 解决方案:我们需要将action的跳转设置成type="redirectAction"。
3. 实例:
?? (1)注:用<param name="message">${message}</param>这种方式传递参数能避免中文乱码的情况。用 ?filevale=${value}会出现乱码
??<action name="addGrowupInfo" class="growupInfoAction" method="addGrowupInfo">
????? <result name="success" type="redirectAction">
?????? <param name="actionName">listGrowupInfo</param>
?????? <param name="message">${message}</param>
????? </result>
??</action>
? (2)注:不同的命名空间action的跳转配置是咧
?<action name="uploadHeadImage" class="ownerSetAction" method="uploadHeadImage">

???<result name="success" type="redirectAction">

????<param name="namespace">/frontStage</param>

????<param name="actionName">gotoPersionCenter</param>

????<param name="flag">9</param>

???</result>

??</action>

?

?

禁止刷新网页、防止刷新网页、禁止后退等操作的代码??

?

<html>???

<head>???

<meta?? http-equiv="Content-Type"?? content="text/html;?? charset=gb2312">???

<noscript><meta?? http-equiv="refresh"?? content="0;url=about:noscript"></noscript>???

<title>屏蔽鼠标右键、Ctrl+N、Shift+F10、Alt+F4、F11、F5刷新、退格键</title>???

</head>???

<body>???

<script>??

//屏蔽鼠标右键、Ctrl+N、Shift+F10、F11、F5刷新、退格键?????

function?? document.oncontextmenu(){event.returnValue=false;}//屏蔽鼠标右键???

function?? window.onhelp(){return false}?????? //屏蔽F1帮助???

function?? document.onkeydown(){???

??? if((window.event.altKey)&&???

????? ((window.event.keyCode==37)||??????????? //屏蔽Alt+方向键←???

????? (window.event.keyCode==39))){??????????? //屏蔽Alt+方向键→

?????????? alert("不准你使用ALT+方向键前进或后退网页!");???

?????????? event.returnValue=false;? ??

????? }???????? if((event.keyCode==8)||??????????????????? //屏蔽退格删除键????

????? (event.keyCode==116)||?????????????????? //屏蔽F5刷新键???

????? (event.ctrlKey && event.keyCode==82)){?? //Ctrl+R???

?????????? event.keyCode=0;???

?????????? event.returnValue=false;???

????? }???

????? if(event.keyCode==122){event.keyCode=0;event.returnValue=false;}??? //屏蔽F11???

????? if(event.ctrlKey && event.keyCode==78)event.returnValue=false;????? //屏蔽Ctrl+n???

????? if(event.shiftKey && event.keyCode==121)event.returnValue=false;??? //屏蔽shift+F10???

????? if(window.event.srcElement.tagName=="A" && window.event.shiftKey)?????

???????? window.event.returnValue=false;?????? //屏蔽shift加鼠标左键新开一网页???

????? if((window.event.altKey)&&(window.event.keyCode==115)){???????? ????//屏蔽Alt+F4????

???????? window.showModelessDialog("about:blank","","dialogWidth:1px;dialogheight:1px");???

???????? return false;???

????? }???

? }???

</script>???

屏蔽鼠标右键、Ctrl+N、Shift+F10、Alt+F4、F11、F5刷新、退格键???

</body>???

</html>

<script type="text/javascript"></script>

?

?

?