[Catalyst] Re: Redispatching actions
Bernhard Graf
catalyst2 at augensalat.de
Mon May 21 22:50:00 GMT 2007
A. Pagaltzis wrote:
> * Bernhard Graf <catalyst2 at augensalat.de> [2007-05-20 21:05]:
> > A. Pagaltzis wrote:
> > > That, plus the re-submit when the user hits the Back button.
> >
> > ...
> > unless ($c->validate_token) { # Catalyst::Plugin::RequestToken
> > $c->stash(message => 'Deja vu!'); # optional verbosity
> > $c->detach('view');
> > }
>
> So loading an extra plugin and sprinkling guards all over your
> code is preferrable to you over simply issuing a redirect. Not
Yes.
> only that, but your choice causes the following sequence of
> events:
>
> User: *hits Back button*
> Computer: This page has POSTDATA. Resubmit it?
> User: (thinks) What the?! Hmm… err…
> User: *hits OK*
> Computer: Ack! You tried to resubmit a form! No cookie!
> User: @#$&!!
>
> Compare to the alternative, where successful submit produces a
> redirect:
>
> User: *hits Back button*
> Computer: *goes back a page*
>
> Guess which one will annoy users less.
Written very nicely. Actually both variants are designed to keep posting
data twice, right?
> You said absolutely nothing to address the “wrong URL” problem
> Matt mentioned, btw.
What wrong URL?
My example showed that http://example.com/data/update is virtually equal
to http://example.com/data/view if not posted from a form.
> Of course, you can spend your days writing code to fight the way
> HTTP works. It’s up to you to judge whether that is a worthwhile
> use of your time. But I do think you’d be happier and your code
> simpler and more robust if it didn’t try to cut against the web’s
> grain.
I don't fight HTTP. A link is one thing, an action is a different one.
While the first always is a static route to some other place, the latter
*acts* upon (input) data and the resulting output depends on this input
data and potentially other data as well (like this RequestToken status,
that tells that the transaction has already been processed when trying
to redo the action, or the request method not being POST).
> > No need for redirects and all the problems they impose.
>
> Can you explain one the problems, please?
See my other post.
> Redirects are one of the greatest features of HTTP, actually.
As GOTO is one of the greatest features of Basic - and of course Perl.
--
Bernhard Graf
More information about the Catalyst
mailing list