This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
    Bookmark Topic Watch Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst
  • Mark post as helpful
  • send pies
  • Report post to moderator
The following is a simple example of a JSP page that uses the Post-Redirect-Get (PRG) pattern.

It uses scriptlets for backward compatibility and to allow the entire pattern to be written in a single JSP page. Note: this does not mean that you should use scriptlets in your pages. It is done here for illustration purposes only!

Lines 1 through 16 simulate typical database read/write operations by reading and appending to a string of text (comments) bound to session scope.

The key to implementing the PRG pattern is to insure that a page is never displayed as a result of a request of type POST. Here, this is done by redirecting to a read-only version of the page after performing a database write (line 16).

To test, copy this page (without the line numbers) into your application and access it through the browser. Add a comment and then click the refresh button. Note that the previous write operation has not been repeated.





Also see DoubleSubmitProblem
 
Yes, my master! Here is the tiny ad you asked for:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!