大家好,我有一些 jsp 页面,我正在使用 struts2 来处理我的表单。 用户提交表单后,地址栏显示的url变成了somthing.action,所以当用户刷新页面时,表单又被提交了。我该如何处理?提交表格后。
最佳答案
如果目标是防止重复提交表单,那么使用token
拦截器http://struts.apache.org/2.x/docs/token-interceptor.html或 tokenSession
拦截器 http://struts.apache.org/2.x/docs/token-session-interceptor.html .
如果您只是想在提交后刷新页面而不再次提交,则重定向到只显示结果而不显示表单的操作。为此使用 redirectAction
结果。
关于java - 避免重复提交Struts 2 jsp页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13529166/