- Post/Redirect/Get
Post/Redirect/Get (PRG) is a common
design pattern forweb application s, to help avoid duplicate form submissions and allowweb application s to behave more intuitively with browser bookmarks and the reload button.After a web user submits a form to a server, the server typically generates an HTML page as a response. To the user, this looks like an ordinary web page, but because it was generated by an
HTTP POST request, it cannot be bookmarked, and attempting to reload/refresh the page in the browser could cause the form information to be resubmitted, possibly with unexpected results (such as a duplicate purchase).To avoid this problem, many web applications use the PRG pattern — instead of returning an HTML page directly, the POST operation returns a redirection command (using the HTTP 303 response code (sometimes 302) together with the HTTP "Location" response header), instructing the browser to load a different page using an HTTP GET request. The result page can then safely be bookmarked or reloaded without unexpected side effects.
External links
* [http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost Redirect After Post] , Michael Jouravlev, August 2004
** [http://www.theserverside.com/patterns/thread.tss?thread_id=20936 Description of the pattern for J2EE] , Michael Jouravlev,August 14 2003 m
* [http://adamv.com/dev/articles/getafterpost GET after POST] Adam Vandenberg
* [http://www.subbu.org/weblogs/main/2006/06/is_the_portlet.html Is the Portlet Programming Model Broken?] Subbu Allamaraju
* [http://www.ajaxray.com/blog/2008/01/12/how-to-avoid-postdata-resend-warning How to avoid POSTDATA resend warning] Anis uddin Ahmad
Wikimedia Foundation. 2010.