javajspstruts2double-submit-problemstruts2-interceptors

WARNING: Form token does not match the session token null


What is the reason for this warning?

WARNING: Form token PR78LAIFZJQRTL66GGAJDT61511L6YHN does not match the session token null

JSP:

<s:form method="post" action="test">
     <s:token></s:token>
     Email:<input name="email" />
</s:form>

Struts.xml:

<action name="test" class="test.RegisterAction">
    <interceptor-ref name="defaultStack" />
    <interceptor-ref name="token" /> 
    <result name="invalid.token">/error.jsp</result> 
    <result>/user/success.jsp</result>
    <result name="error">/error.jsp</result>
</action>

Solution

  • The order of the interceptor token should be first. For example

    <interceptor-ref name="token" />
    <interceptor-ref name="defaultStack" />
    

    The reason why your session token is null might be the session is expired or closed.