cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobia <tobia.confo...@linux.it>
Subject Re: Redirect at the end of a form
Date Mon, 04 Jun 2007 13:08:05 GMT
Baptiste Placé wrote:
> Have you tried stocking form data into a collection, and send it to
> the final page?

I'm not sure I understand


> Refreshing the page re-executing the db actions mean the final page
> triggers the DB part of your flowscript.  Maybe your final page is
> invoking the same function than the first one ?

In my example I only had one form, so the client/server interaction was
like this sequence diagram (you will need a fixed font to see it):


Client                                 Server (flowscript)

open the page w/ the form    --GET-->  function call
:                                       \_ new Form()
:                                       \_ showForm()
:                                           \_ internal validation loop
display the form             <·······           \_ sendPageAndWait()

try and submit the form      --POST->           \_ validation FAILS
redisplay the form           <·······           \_ sendPageAndWait()

try and submit the form (*)  --POST->           \_ validation SUCCEEDS
:                                       \_ DB operations
display the results          <·······   \_ final sendPage()


Read it like this:
  1 ---> 2
         3
  5 <··· 4

The problem is, if the user doesn't get the final results page (for
whatever reason) she will hit refresh and the flowscript will resume
from (*), which is a Bad Thing.

With my addition, the last part of the sequence diagram looks like this:


try and submit the form      --POST->           \_ validation SUCCEEDS
:                                       \_ DB operations
:                                       \_ redirectToGet()
:                                           \_ createWebContinuation()
receive the redirect         <·······       \_ redirectTo()

follow the redirect (*)      --GET-->       \_ return
display the results          <·······   \_ final sendPage()


Any refresh will make the flowscript resume from (*), which is correct.


It seems to me that any non-trivial use of createWebContinuation() needs
a flag variable (var done in my example) and a subsequent test.  Is that
correct?  Am I missing something?


Tobia

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message