TokenHelper - 找不到映射到令牌名称 struts.token 的令牌 [英] TokenHelper - Could not find token mapped to token name struts.token
本文介绍了TokenHelper - 找不到映射到令牌名称 struts.token 的令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我添加了 "execAndWait"
拦截器,它会给我上面的错误:
If I add the "execAndWait"
interceptor, it gives me the above error:
TokenHelper - Could not find token mapped to token name struts.token
配置:
<action name="flightsearch" method="getFlightResult"
class="com.test.FlightSearchAction">
<interceptor-ref name="execAndWait">
<param name="delay">500</param>
<param name="delaySleepInterval">500</param>
</interceptor-ref>
<!-- <interceptor-ref name="token">
<param name="excludeMethods">getFlightResult</param>
</interceptor-ref> -->
<result name="wait" type="tiles">flightwait</result>
<result name="success" type="tiles">flightsearchresult</result>
</action>
<interceptors>
<interceptor-stack name="tokenCheck">
<interceptor-ref name="token" />
<interceptor-ref name="defaultStack" />
<interceptor-ref name="basicStackHibernate" />
</interceptor-stack>
<interceptor-stack name="loggingRequired">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="basicStackHibernate" />
</interceptor-stack>
</interceptors>
正如我所读到的,有人说这是一个警告,我们可以通过更改 TokenHelper
类来避免它.如果是这样怎么办?
As I have read, some says this is an warning, and we can avoid it by changing the TokenHelper
class. If so how to do that?
推荐答案
此警告仅在 ActionContext
包含参数 token
时出现.在 execAndWait
拦截器之前移除这个参数.
This warning appears only if ActionContext
contains the parameter token
. Remove this parameter before the execAndWait
interceptor.
ActionContext.getContext().getParameters().remove("token");
顺便说一句,execAndWait
拦截器应该在 completeStack
之后启动.例如
BTW, the execAndWait
interceptor should start after the completeStack
. For example
<action name="someAction" class="com.examples.SomeAction">
<interceptor-ref name="completeStack"/>
<interceptor-ref name="execAndWait"/>
<result name="wait">wait.jsp</result>
<result name="success">success.jsp</result>
</action>
这篇关于TokenHelper - 找不到映射到令牌名称 struts.token 的令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文