I came across this
<s:token /> tag and it is enclosed in a
<s:form></s:form> tag in a JSP Page. Some other StackOverflow link discusses its usage in maintaining session and prevention of double submission of forms. What exactly is the use of this tag? If it prevents double submission of form then what happens when I submit form and how does it prevent it?
Best How To :
Here I am answering my own question because this may help someone in future, though I will try to dig more on this and get it updated.
The plain English explanation I found:
"The token tag generates an unique token which is used to find out whether a form has been double submitted. When the form is rendered, a hidden variable is placed as the token value. Let us say, for example that the token is "ABC". When this form is submitted, the Struts Filter checks the token against the token stored in the session. If it matches, it removes the token from the session. Now, if the form is accidentally resubmitted (either by refreshing or by hitting the browser back button), the form will be resubmitted with "ABC" as the token. In this case, the filter checks the token against the token stored in the session again. But because the token "ABC" has been removed from the session, it will not match and the Struts filter will reject the request." (Source)
However these two StackOverflow answers add more to knowledge.