user3773498
user3773498

Reputation: 11

Prevent re-execute action in struts

this is probably an old question, but I just couldn't find an answer anywhere... is there any way to prevent re-execute action in struts (other than re-direct to another page) when user clicks the refresh or back button on the browser?

Upvotes: 0

Views: 87

Answers (1)

hari
hari

Reputation: 1963

index.jsp

   <form action='call_action'>
       <input type='text' name='name'/>
       <s:token name="token"></s:token>
   </form>

In struts.xml

     <action name="call_action" class="controller.ActionClass">
        <interceptor-ref name="token" />  
        <interceptor-ref name="basicStack"/>
        <result name="invalid.token">invalid_token.jsp</result>
        <result name="success">signup.jsp</result>
      </action>

add invalid_token.jsp in your project.if unfortunetly user clicked second time.it automatically forward to invalid_token.jsp Page.

Upvotes: 1

Related Questions