The <s: token/> label prevents repeated submission. The usage is as follows:
Step 1: Add <s: token/> to the form.
<S: Form Action = "helloworld_other" method = "Post" namespace = "/test">
<S: textfield name = "person. Name"/> <s: token/> <s: Submit/>
</S: Form>
Step 2:
< Action Name = "Helloworld _*" Class = "Com. Jim. Action. helloworldaction" Method = "{1 }" >
< Interceptor-ref Name = "Defaultstack" />
< Interceptor-ref Name = "Token" />
< Result Name = "Invalid. Token" > /WEB-INF/page/message. jsp</ Result >
< Result > /WEB-INF/page/result. jsp </ Result >
</ Action >
The above configuration is added with the "token" interceptor and "invalid. token result. Because the token interceptor returns "invalid" directly when the session token is inconsistent with the requested token. token.
In the debug status, the following information is displayed on the console because the Struts. Token and Struts. Token. Name attributes are not in the action. We do not need to care about this error:
Severe: parametersinterceptor-[setparameters]: Unexpected exception caught setting 'struts. token 'on 'class XXX: Error setting expression' struts. token 'with value' [ljava. lang. string; @ 39f16f'
Severe: parametersinterceptor-[setparameters]: Unexpected exception caught setting 'struts. Token. name'