I have been attempting to get the tokenSession interceptor to work (Struts 2.0.14) but always get the warnings:
2013-03-13 08:32:09,395 [17] DEBUG Intercepting invocation to check for valid transaction token. | org.apache.struts2.interceptor.TokenSessionStoreInterceptor.doIntercept(128)
2013-03-13 08:32:09,395 [17] WARN Could not find token name in params. | org.apache.struts2.util.TokenHelper.getTokenName(124)
2013-03-13 08:32:09,396 [17] DEBUG no token name found -> Invalid token | org.apache.struts2.util.TokenHelper.validToken(154)
2013-03-13 08:32:09,397 [17] WARN Could not find token name in params. | org.apache.struts2.util.TokenHelper.getTokenName(124)
2013-03-13 08:32:09,397 [17] WARN Could not find token mapped to token name null | org.apache.struts2.util.TokenHelper.getToken(105)
2013-03-13 08:32:09,398 [17] DEBUG Forwarding to location /WEB-INF/view/support/TokenError.jsp | org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(113)
The struts.xml has the following interceptor configuration:
<package name="survey" extends="struts-default">
<result-types>
<result-type name="csv"
class="webapp.CsvResultType"/>
</result-types>
<interceptors>
<interceptor name="log"
class="struts.LoggingInterceptor"/>
<interceptor name="formAuthentication"
class="security.FormAuthenticationInterceptor"/>
<interceptor-stack name="default">
<interceptor-ref name="log"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="formAuthentication"/>
<!--interceptor-ref name="chain"/>-->
<interceptor-ref name="fileUpload"/>
<interceptor-ref name="checkbox"/>
<interceptor-ref name="params"/>
</interceptor-stack>
<interceptor-stack name="defaultTokenStack">
<interceptor-ref name="tokenSession"/>
<interceptor-ref name="default"/>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="default"/>
<!-- -->
<global-results>
<result name="blank">/WEB-INF/view/support/Blank.jsp</result>
<result name="error">/WEB-INF/view/support/Error.jsp</result>
<result name="insufficientPrivileges">/WEB-INF/view/support/InsufficientPrivileges.jsp</result>
<!--result name="file" type="file"></result-->
</global-results>
</package>
With the action definitions:
<package name="respondent" namespace="/respondent" extends="survey">
<action name="*" class="controller.respondent.{1}Action">
<interceptor-ref name="defaultTokenStack"/>
<result name="list">/WEB-INF/view/respondent/{1}List.jsp</result>
<result name="edit">/WEB-INF/view/respondent/{1}Edit.jsp</result>
<result name="view">/WEB-INF/view/respondent/{1}View.jsp</result>
<result name="success">/WEB-INF/view/respondent/{1}.jsp</result>
<result name="invalid.token">/WEB-INF/view/support/TokenError.jsp</result>
</action>
</package>
The jsp has the token tag:
<s:form action="FunctionSummary.action" method="post">
<s:token/>
<table class="buttons">
<tr>
<s:if test="surveyStarted">
<td><s:submit value="Resume Survey"/></td>
</s:if>
<s:else>
<td><s:submit value="Start Survey"/></td>
</s:else>
</tr>
</table>
</s:form>
Any access to this page always results in redirection to the invalid.token result and the warnings above.
I have validated that without the interceptor configured, the page source does have the token but I cannot get the sessionToken interceptor to see it.
Any help would be most appreciated...
Thanks
Try to put your
<s:token/>tag into your<table>tags. I got the same problem just like you. And after I put<s:token/>into<table>tag problem solved.