views:

301

answers:

2

I use Token Session to prevent duplicate form submits, but the first time I make a request to server, I always get error page

<action name="show" class="ClientAction">
    <interceptor-ref name="tokenSession" />
    <interceptor-ref name="basicStack" />
    <result name="invalid.token">/WEB-INF/error.jsp</result>
    result type="tiles" name="success">page.view</result>
</action>

"<s:token />" was added to may success page between <s:form> and </s:form>, but it doesn't run correctly.

plz help me to solve them, is there another way prevent duplicate form submits. I wait for suggestion, thank u very much. : )

+1  A: 

It seems that you are not using proper interceptor name. If you want to use the session token, it is token-session.

try using token-session instead of tokenSession.

Hope that helps.

cha
A: 

Hi,

tag <s:token /> must be inserted into form which is double-submitted, not into success form. If token tag is missing, interceptor resolve the submitted request as invalid even if it's the first attempt.

koulik