Hi everyone,
anyone knows how to use struts' Token system to avoid duplicated
request/back button with xml and xsl? I know there are something like stxx
but I still want to use the "traditional" struts framework to implement my
project and I try to get the most out of it. I want to use struts to check
duplicated request and check clicking back button. I am using the the
following way to make it work:
1. displayformActionClass => 2. display displayform.jsp => 3. click submit
button => 4. processformActionClass => 5. displayformresult.jsp
These are the steps -
=> 1. (saveToken)
=> 2. put session.getAttribute(Action.TRANSACTION_TOKEN_KEY) into the hidden
variable of the form by putting xml tag into the from in xsl
=> 3.
=> 4. call isTokenValid(). if !errors.empty(), call saveToken() else
resetToken()
=> 5.
I need to use session.getAttribute(Action.TRANSACTION_TOKEN_KEY) because
I cannot put the struts tag into xsl file and so I cannot use
<html:html><html:form></html:form></html:html> in the file displayform.jsp.
And so I do not know the struts framework is working correctly or not.
This is the generated hidden variable after showing displayform.jsp:
<input type="hidden" name="org.apache.struts.taglib.html.TOKEN"
value="74884694861f57bea8b3225a6777ccfc">
Anyone can help? I am very appreciated if anyone can show the codes how
they make it work. I've already spent a lot of time to investiage....
Thank you
Jason