struts2双重提交问题
我使用的是struts2.1.8。这里我想处理双重提交。 truts2提供了TokenInterceptor。因此,如果我提交两次,它会返回“invalid.token”作为结果名称。但我想显示我提交两次的同一页面。
I am using struts2.1.8. Here I want to handle double submission.
truts2 provides TokenInterceptor. So if I submitted two times, it returns "invalid.token" as a result name. But I want to display the same page from which I have submitted twice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
由于您想要显示双重提交的同一页面,因此您需要在每个
定义中创建一个invalid.token
结果。试图防止重复提交:文档提供更多信息,您可能还想考虑查看 令牌会话拦截器。
Since you want to display the same page that you double-submitted from, you'll need to create an
invalid.token
result in each of the<action>
definitions you're trying to prevent double submission from:The docs provide more info and you might also want to consider looking into the Token Session Interceptor.
您的应用程序中是否需要双重提交功能?
如果要防止重复提交问题,最好实现“Post 后重定向”模式,请参阅以下两个链接以获取详细说明:
http://www.theserverside.com/news/1365146/Redirect-After-Post
http://en.wikipedia.org/wiki/Post/Redirect/Get
Is double submission required functionality in your application?
If you want to prevent double submit problems it is better to implement the Redirect after Post pattern, see the following two links for a detailed explanation:
http://www.theserverside.com/news/1365146/Redirect-After-Post
http://en.wikipedia.org/wiki/Post/Redirect/Get
查看TokenSessionInterceptor,它建立在 TokenInterceptor。来自文档:
Look at the TokenSessionInterceptor, which builds upon the TokenInterceptor. From the docs: