I have struts2 action method. It will be called from different server. i.e. In our applciation we are integrating the icici Payment gateway. My action method will be called from icici server. In that method i am performing some logic. Based on logic it will be redirected to some other action.
<action name="iciciResponse" class="com.yatrasoft.yatratravel.agent.b2c.PaymentGateWayAction" method="iciciResponse">
<result name="buybusTicket" type="redirect">/tentativeBusbooking.action?searchKey=${getSearchKey()}</result>
</action>
My booking logic is present in tentativeBusbooking() .After executing this method the result will be displayed to the end-user. Now browser URL will be like this.
http://192.168.0.94:8080/travelyatra/tentativeBusbooking.action?searchKey=NDIwMTMzMDR8MTQ5OTA4MjF8bnVsbHxudWxsfG51bGx8bnVsbHxudWxsfG51bGx8bnVsbHxudWxsfHxud
But the problem is, if the user refresh the browser, the tentativeBusbooking() is getting executed once again.
If i have JSP page, by using the s:token we can avoid the double form submission. But my action is called directly from the other server. So, How to avoid the double submission in this scenario.
If i need to write my own logic for this,can u help me. I am trainee s/w engineer(5 months experience only)…
My suggestion would be to do a redirectAction after tentativeBusbooking(). In this scenario, instead of returning SUCCESS, you would return a result such as “bookingComplete” with a result type of redirectAction.
The result would be a display only jsp and if the page is refreshed, only the results would be displayed, not the original submission.
For example:
In the annotated example above, the bookingComplete result would result type would redirect the action back onto itself after the tentativeBusbooking() calling the execute() rather than the tentativeBusbooking() again when refreshed.