避免重复提交Struts 2 jsp页面 [英] Avoid duplicate submission of Struts 2 jsp page

查看:83
本文介绍了避免重复提交Struts 2 jsp页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我有一些jsp页面,并且即时通讯使用struts2来处理我的表单。
在用户提交表单后,地址栏中显示的URL变成somthing.action,所以当用户刷新页面时,表单会重新提交。我该如何处理?如果目标是防止重复提交表单,那么使用标记。

拦截器 http://struts.apache.org /2.x/docs/token-interceptor.html tokenSession 拦截器 http://struts.apache.org/2.x/docs/token-session-interceptor.html



如果您希望简单地在提交后刷新页面而不再提交,那么将重定向到仅显示结果而不是表单的操作。使用 redirectAction 结果。


Hi all I've got some jsp pages and im using struts2 to handle my forms. After submitting a form by user, the url shown in address bar becomes somthing.action, so when the user refreshes the page, the forms gets submitted again. How can I handle this? after submission of a form.

解决方案

If the goal is to prevent duplicate submission of forms then use token interceptor http://struts.apache.org/2.x/docs/token-interceptor.html or tokenSession interceptor http://struts.apache.org/2.x/docs/token-session-interceptor.html.

If you simple want to refresh the page after submit without submitting again then redirect to action where you only show results not form. Use redirectAction result for that.

这篇关于避免重复提交Struts 2 jsp页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆