Question

I'm working on a webapp project with struts2 and I would like to prevent making duplicate entries when a form submit button is clicked multiple times. I'd prefer to handle this issue in the server side to make sure browser compatibility. The webapp follows the workflow FORM -> ACTION (which in most cases, validateSave() then save()) -> RESULTPAGE(which is a jsp). I am using "continue" to link the FORM->RESULT page. I have read that redirection would be better but in some cases I am setting a bean(scope is request) in the ACTION that is needed to properly load the RESULT page.

This is where I am having trouble with TokenSession. I am able to skip the saving if the request is a duplicate but I am not able to set the bean properly to load the RESULT page.

Would Appreciate any help, Thanks in advance.

Was it helpful?

Solution

This might help you.

As Struts 2 provides token interceptor that can we used to handle multiple form submission problem.

http://www.journaldev.com/2281/struts2-token-interceptor-to-handle-double-form-submission-problem

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top