令牌会话使用令牌来防止重复的表单提交?

发布于 2024-08-18 20:10:37 字数 565 浏览 1 评论 0原文

我使用令牌会话来防止重复的表单提交,但是第一次向服务器发出请求时,我总是收到错误页面

<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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ぃ双果 2024-08-25 20:10:37

您似乎没有使用正确的拦截器名称。如果要使用会话令牌,则为 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.

你是暖光i 2024-08-25 20:10:37

标签 必须插入到双重提交的表单中,而不是插入到成功表单中。如果令牌标记丢失,拦截器会将提交的请求解析为无效,即使这是第一次尝试。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文