当我使用时,我正在测试令牌的不同场景并遇到此问题:
<action name="sincronizar" class="action.SincronizarAction">
<interceptor-ref name="token"/>
<interceptor-ref name="mystack"/>
<result name="success" type="tiles">d_sincronizar</result>
<result name="input" type="tiles">d_sincronizar</result>
<result name="invalid.token" type="tiles">d_sincronizar</result>
</action>
在控制台中出现此错误:
WARNING: Error setting expression 'struts.token' with value '[Ljava.lang.String;@3584de'
ognl.OgnlException: target is null for setProperty(null, "token",
[Ljava.lang.String;@3584de)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2312)
at ognl.ASTProperty.setValueBody(ASTProperty.java:127)
现在我用“basicStack”重拍:
<action name="sincronizar" class="action.SincronizarAction">
<interceptor-ref name="token"/>
<interceptor-ref name="basicStack"/>
<result name="success" type="tiles">d_sincronizar</result>
<result name="input" type="tiles">d_sincronizar</result>
<result name="invalid.token" type="tiles">d_sincronizar</result>
</action>
而不是问题。但我需要使用我的堆栈。另外,当我使用相同的拦截器制作新堆栈时,也会遇到同样的问题。示例:lowStack 相同的 basicStack http://struts.apache.org/development/2.x/docs/interceptors.html
<interceptor-stack name="lowStack">
<interceptor-ref name="exception"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="prepare"/>
<interceptor-ref name="checkbox"/>
<interceptor-ref name="multiselect"/>
<interceptor-ref name="actionMappingParams"/>
<interceptor-ref name="params"/>
<interceptor-ref name="conversionError"/>
</interceptor-stack>
<action name="sincronizar" class="action.SincronizarAction">
<interceptor-ref name="token"/>
<interceptor-ref name="lowStack"/>
<result name="success" type="tiles">d_sincronizar</result>
<result name="input" type="tiles">d_sincronizar</result>
<result name="invalid.token" type="tiles">d_sincronizar</result>
</action>
我也有同样的问题。