Christopher Oliver wrote:

I think you're making this much more complicated than it needs to be. Please look at how JXForms does this. First it creates a continuation immediately before and immediately after a page is sent to the browser. The latter continuation behaves exactly like sendPageAndWait(). However, by invoking the former you cause the page to be resent (and processing to restart when that page is resubmitted). So:

1) If you invoke the current continuation processing continues after the current page is submitted.
2) If you invoke its parent continuation the current page is resent to the browser.
3) If you invoke the grandparent continuation the actions following submission of the previous page are replayed.
4) If you invoke the great-grandparent continuation the previous page is resent to the browser.


So to implement the "back" button, you invoke (4).

The idea is that instead of only encoding the continuation id in the form or request url, you also associate a "forward" or "back" action with the submit button. The form submits are _always_ submitted to the same location, where some Java or JavaScript code looks at the continuation id together with "forward" or "back" indication of the submit button. If the indication is "forward" then you simply look up the continuation associated with the continuation id and invoke it. But if the indication is "back" then you invoke the great-grandparent of the continuation.


I'll look more closely to JXForms. However, does the above behaviour fit with the fact that form.showForm() creates several continuations when iterating until the form is valid? In that case, we cannot just consider restarting at the n-2th or n-3th continuations, since intermediate continuations may have occured inbetween...

With this approach your example reduces to this (and most importantly you don't have to explicitly code back/forward navigation in your flow script):

function myWizard() {
var wizard = new Wizard("wizard-spec.xml");
wizard.show("first-page.html");
wizard.show("second-page.html");
wizard.show("third-page.html");
cocoon.sendPage("finished.html");
}


Mmmh... what I don't like above is that the wizard is sending the pages. How can we with this approach mix form.showForm and cocoon.sendPageAndWait in the same wizard-style interaction?

Sylvain

--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com




Reply via email to