addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwchatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-crosscrosseditemptyheartfacebookfolderfullheartglobegmailgoogleimagesinstagramlinklocation-pinmagnifying-glassmailminusmoremuplabelShape 3 + Rectangle 1outlookpersonplusprice-ribbonImported LayersImported LayersImported Layersshieldstartrashtriangle-downtriangle-uptwitteruseryahoo

Re: [ljc] Redirect after post...

From: user 7.
Sent on: Monday, February 18, 2013 9:17 AM
Morning Wesley!

I wouldn't say always, and although most of the time the Post-Redirect-Get approach results in implicitly better behaviour, I would rather take your approach and say where it is warranted. I think it's much more important to keep an open mind and think about each situation on its own merits.

I would, however, despite the slight added complexity of having a session persisted message queue, do this even for the sign up form. Even though validation prevents a repeat submission and the "account already exists" message seems appropriate technically it may not make sense to a user. I only redirect if the POST was successful, on failure simply view the form otherwise this would definitely cause an unreasonable level of complexity, persisting all of the validation messages and input.

As for JavaScript augmented applications, where JavaScript is applied optionally to provide a better experience, posting via AJAX makes sense as you can create a smoother user experience and show things like progress and completion messages. The Post-Redirect-Get method is still useful here although it is down to the JavaScript layer to perform the redirect upon success and is really the only option in this case.

Finally, with JavaScript driven applications that are delivered from a single request and perform AJAX requests under the hood, redirecting in this sense to me means updating the hash. With this type of application, you can either change the hash on completion but often the easiest method is to not hash anything that mutates state, so all POST, DELETE and PUT actions are handled as application level events and not navigable routes.

Now I'm sure there are caveats to this, I'm just going by my experiences.


On Mon, Feb 18, 2013 at 7:00 AM, Wesley Hall <[address removed]> wrote:
Hey folks,

I am interested in views on the 'Post-Redirect-Get' pattern of form
handling. Just had a fairly lively discussion on this at the office
and I am interested to get other opinions.

It's a technique that I personally, use when I feel it is warranted,
rather than as a matter of course. For example, when it comes to forms
that will naturally reject multiple submissions (for example, a signup
form, where a repeat submission will result in an 'account already
exists' error), I tend not to use the pattern, mostly since it avoids
slightly more complicated handling code on the server, and having to
float error messages around in sessions.

We also have opinions here that the pattern should be used for every
form submissions as a matter of course, and that web form submissions
should be handled using AJAX (I have some sympathy with this
suggestion, despite the extra complexity since it allows for fairly
fine-grained control over refresh and back-button behaviour).

Anyone have any specific thoughts on this? Keen to hear some opinions.



Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Wesley Hall ([address removed]) from LJC - London Java Community.
To learn more about Wesley Hall, visit his/her member profile:
Set my mailing list to email me

As they are sent

In one daily email

Don't send me mailing list messages
Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]

Our Sponsors

  • Our Blog

    Read the latest news from the LJC

  • RecWorks Ltd

    Fixing Tech Recruitment using the Power of Community

  • jClarity

    Java/JVM Performance Analysis Tools & mentoring for Java related matters

  • LJC Aggrity

    Our LJC Aggrity site contains blog posts from our members

  • LJC Book Club

    Our Book club with book reviews from our members

  • Devoxx UK

    Java Community Conference in collaboration with the LJC, 8-10th June 16

  • SkillsMatter

    "Host, help organise, promote, film many of our meetings."

  • IBM

    Build Enterprise-grade apps at start-up speed.

  • New Relic

    New Relic makes sense of billions of metrics a day in real time.

  • Hazelcast

    Hazelcast is the leader in operating in-memory computing.

  • Java.Net

    We are an official Java User Group recognised by Oracle's JUG program

  • JRebel

    Free 3 month J-Rebel license.

  • O'Reilly

    40% discount on printed books and 50% on e-books.

  • Craft Rebellion

    Your choice of fresh craft beer, delivered. For 10% off use ‘LJC'

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy