tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thijs Suijten <t.suij...@semantica.nl>
Subject Re: PRG pattern (POST-REDIRECT-GET)
Date Mon, 04 Apr 2005 08:17:28 GMT

I already use the "form submit synchronization token", sure it solves 
the unsynchronized state of my application but it doesn't work 
intuitively for our users. I even (who build the web application) 
sometimes accidentally press the back button...

I think the state issue can be overcome. I think the there are two options:

- Redirect immediately: in the RedirectService (something like 
DirectService) a redirect immediately takes place and all parameters 
must be copied into the session Object, the service which is redirected 
to must read and discard these session parameters and rewind the request.

- Redirect formSubmit: The rewind cycle takes place as usual and at the 
end of the rewind phase a redirect is triggered. No parameters have to 
be stored in the session Object because the rewind phase was responsible 
for processing/persisting the parameters.

The second option can already be used manually to realize the PRG 
pattern. For example:

    public void submitForm(IRequestCycle cycle) {
        PageService s = new PageService();
        String redirect = s.getLink(cycle, this, new 
        throw new RedirectException(redirect);

Instead of:

    public void submitForm(IRequestCycle cycle) {

Erik Hatcher wrote:

> On Apr 1, 2005, at 8:20 AM, Thijs Suijten wrote:
>> Wouldn't it be nice to once and forever get rid of "back" "forward" 
>> and "refresh" hell while developing a web application?
>> I've been developing with Tapestry for quit some time now and really 
>> love it! Out application is a very complex Document Management System 
>> and contains a lot of POST requests. Because of the post request we 
>> have a "don't touch the back/foward/refresh" button police for our 
>> users which mostly don't like this.
>> I've been reading the following article which provides an easy but 
>> effective solution for the back/foward/refresh problem. It would be 
>> VERY nice if this solution could be implemented in Tapestry Framework 
>> to get rid of the back/foward/refresh problem forever!
>> http://www.theserverside.com/articles/article.tss?l=RedirectAfterPost
>> Please let me know what you think about this.
> We've recently been discussing this very issue.  I have implemented 
> within my project as a prototype a service/link combination which 
> replaces DirectLink and does the redirect after post.
> There are issues with this technique - what about state?  In your 
> application you do a lot of POST - but then you activate to a page 
> with the same information or activate a new page transferring some 
> state over to it all server-side.  How will you deal with that in a 
> redirect scenario?  What about validation errors?  Yes, this problem 
> is solvable by putting state into session scope, but is that what you 
> really want to do?
> Maybe the form submit synchronization token technique is more along 
> the lines of what you need to avoid duplicate form submissions?
>     Erik
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Thijs Suijten
Email: t.suijten@semantica.com
Web: http://www.semantica.nl
DocsDB: http://www.docsdb.com
Phone: +31 71 5414471
Fax: +31 71 5411892

No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.1 - Release Date: 1-4-2005

To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org

View raw message