避免重复提交Struts 2 jsp页面 [英] Avoid duplicate submission of Struts 2 jsp page
问题描述
在用户提交表单后,地址栏中显示的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屋!