Post Redirect Get Pattern

This is one of the web design pattern which is used to prevent the double form submission issue.

In the old days, when we design an application with JSP’s, we often face double form submission issue. So one of the best way to avoid this to disable the submit button as soon as the submit button is clicked. But if we show the result on same JSP page, then if the user refreshes the browser, then the form will be submitted again which cause some undesirable issues.

To avoid these kinds of errors/issues, we may need to change the API/server code to validate the request and some custom states. So it requires some unnecessary state maintenance in the server side.

Post Redirect Get pattern comes to the rescue in this kind of situation. Please refer the below diagram.



Here in this case, As soon as the user submits the form, the server does the operation on the backend and also forces the browser to redirect to a confirmation page. So if the user refreshes the confirmation page, then it would not have any impact as it will not do any operation other than showing the confirmation page.

But we have to keep in the below points along with this pattern.

  1. Disable the Submit button as soon as the user clicks on it
  2. If the server takes long time to respond back with the confirmation page and user tries to stop the browser and refresh the page in the mean time, then it will cause some other issues. So to handle these kind of issues, we have to either maintain some state and by checking this we can prevent the double submission issues.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s