Tuesday, June 14, 2011

Way to Prevent Duplicate Request from Form in J2EE applications -2

Guys,

Here is the another solution to prevent duplicate form submission issue in web applications irrespective of the framework implementation.

Can you please try with the below code and update me in comments?

In JSP, we can have java script method during onsubmit like below.


And our java script implementation would be like below. submitForm method return true only very first time and form will be submitted. The same will be true for the sub sequent requests. Hope this will solve our issue.

//Global variable
var submitFlag = 1;

//Submit form method
function submitForm(form) {
if ( submitFlag == 1 ) {

submitFlag = 2;
return true;

} else {
return false;

}
}


Thanks,

-Nanjundan Chinnasamy

No comments:

Pega Decisioning Consultant - Mission Test Quiz & Answers

The Pega Certified Decisioning Consultant (PCDC) certification is for professionals participating in the design and development of a Pega ...