令牌会话使用令牌来防止重复的表单提交?
我使用令牌会话来防止重复的表单提交,但是第一次向服务器发出请求时,我总是收到错误页面
<action name="show" class="ClientAction">
<interceptor-ref name="tokenSession" />
<interceptor-ref name="basicStack" />
<result name="invalid.token">/WEB-INF/error.jsp</result>
result type="tiles" name="success">page.view</result>
</action>
"
was added to may success page between
和 ,但无法正确运行。
请帮助我解决这些问题,是否有其他方法防止重复的表单提交。我等待建议,非常感谢。 :)
I use Token Session to prevent duplicate form submits, but the first time I make a request to server, I always get error page
<action name="show" class="ClientAction">
<interceptor-ref name="tokenSession" />
<interceptor-ref name="basicStack" />
<result name="invalid.token">/WEB-INF/error.jsp</result>
result type="tiles" name="success">page.view</result>
</action>
"<s:token />"
was added to may success page between <s:form>
and </s:form>
, but it doesn't run correctly.
plz help me to solve them, is there another way prevent duplicate form submits. I wait for suggestion, thank u very much. : )
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您似乎没有使用正确的拦截器名称。如果要使用会话令牌,则为 token-session。
尝试使用 token-session 而不是 tokenSession。
希望有帮助。
It seems that you are not using proper interceptor name. If you want to use the session token, it is token-session.
try using token-session instead of tokenSession.
Hope that helps.
标签
必须插入到双重提交的表单中,而不是插入到成功表单中。如果令牌标记丢失,拦截器会将提交的请求解析为无效,即使这是第一次尝试。tag
<s:token />
must be inserted into form which is double-submitted, not into success form. If token tag is missing, interceptor resolve the submitted request as invalid even if it's the first attempt.