cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ovidiu Predescu <ovi...@cup.hp.com>
Subject Re: continuation fear (was Re: [status & RT] design challenges)
Date Thu, 11 Apr 2002 17:54:13 GMT
On Thu, 11 Apr 2002 07:15:10 -0500, "Ivelin Ivanov" <ivelin@apache.org> wrote:

> > Say the checkbox could be obtained from the request using the "hasCar"
> > name. You can then write something like this:
> >
> > function transaction()
> > {
> >   ...
> >   sendPage("page1");
> >   var hasCar = cocoon.request.getParameter("hasCar");
> >
> >   // do some other stuff to prepare page2, then send it
> >   ...
> >   sendPage("page2");
> >
> >   // now if the user has a car we need to ask information on the car
> >   if (hasCar) {
> >     sendPage("getCarInfo");
> >
> >     var make = cocoon.request.getParameter("make");
> >     var model = cocoon.request.getParameter("model");
> >     var color = cocoon.request.getParameter("color");
> >
> >     // pass the above information to the Java business logic to insert
> >     // it in a database
> >   }
> >
> >   // now ask other questions
> >
> >   sendPage("restOfQuestions");
> >
> >   ...
> > }
> >
> >
> > The idea is that since the flow control is a full programming
> > language, you can do pretty much everything in it.
> >
> > As you notice the flow control is acting the Controller in the
> > Model-View-Controller paradigm (MVC). The Model is the business logic
> > behind, and the View is invoked using sendPage().
> 
> Beautiful.
> 
> I want to understand more of the internals. How do you ensure that
> the "action" attribute on the form in "page1" points to a URL which
> will allow sendPage("page1") to ever return?

Good question!

If you look in the implementation of sendPage, you'll notice that the
WebContinuation object is also passed down to the Cocoon pipeline. In
the jpath.xsl logicsheet there's a <jpath:continuation> element, which
will insert in the output page the continuation identifier.

You can use this in the XSP page to generate the value for the
"action" attribute of the form. Check out the getNumberA.xml and so on
pages in the calculator Schecoon example (in the webapp/examples/calc/
directory).

Greetings,
-- 
Ovidiu Predescu <ovidiu@cup.hp.com>
http://www.geocities.com/SiliconValley/Monitor/7464/ (GNU, Emacs, other stuff)

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


Mime
View raw message