Is it better to 'remember' original request parameters as variables in
flowscript, or to pass them via hidden form fields through the
pipeline? The goal is for the next pipeline to have access to them.

Below are two examples. I've tried to be as succinct as possible. So,
you'll just have to use your imagination for the missing pieces. :)


Here's the first example, if I use variables within flow:

var foo = cocoon.request.getParameter("foo");
cocoon.sendPageAndWait("getUserInput");
cocoon.sendPage("displayResults", { foo: foo } );

<map:match pattern="getUserInput"/>
 <map:generate type="file" src="foo.xml"/>
 <map:transform type="xslt" src="bar.xsl"/>
 <map:serialize type="html"/>
</map:match>

/* HTML generated by the getUserInput pipeline */
<form action="68546a264d336f0b313a58595a704b024a2e7e8b.continuation">
 <input type="text" name="textField"/>
 <input type="submit"/>
</form>

/* After the user submits the form, the continuation picks up with
this final pipeline */
<map:match pattern="displayResults">
 <map:generate type="file" src="bar.xml"/>
 <map:transform type="xslt" src="baz.xsl">
  <map:parameter name="originalValueOfFooParameter"
value="{flow-attribute:foo}"/>
 </map:transform>
 <map:serialize type="html"/>
</map:match>

Of course, the JXTemplateGenerator, or any number of methods could be
used to inject the value of foo into the displayResults pipeline..




Here's the second example, if I use hidden form fields:

cocoon.sendPageAndWait("getUserInput");
cocoon.sendPage("displayResults");

/* The request generator provides the original value of the foo
parameter to the stylesheet */
<map:match pattern="getUserInput">
 <map:generate type="request"/>
 <map:transform type="xslt" src="foo.xsl"/>
 <map:serialize type="html"/>
</map:match>

/* HTML generated by the getUserInput pipeline */
<form action="32434378822575115d252d213251313e0f2d4e14.continuation">
 <input type="hidden" name="foo" value="whatever"/>
 <input type="text" name="textField"/>
 <input type="submit"/>
</form>

/* After the user submits the form, the continuation picks up with
this final pipeline */
<map:match pattern="displayResults">
 <map:generate type="request"/>
 <map:transform type="xslt" src="bar.xsl"/>
 <map:serialize type="html"/>
</map:match>





Now, I expect that the answer will be that I should use variables
within flowscript. I've seen that the flow tutorial and examples do
things this way.

The only thing I don't like about using flow variables, is that I have
to pass them all through when I call a sendPage or sendPageAndWait. In
this example, I only had one original parameter, but suppose I had 50?
Even worse, suppose that I don't know the names of each parameter, or
that the potential set of provided parameters is highly volitile.

The advantage to using hidden form fields, is that I can handle any
number of original parameters, and don't have to worry about what
they're named. The request generator gives me all that information for
free, and my stylesheet can transform them easily. The downsides of
this method is that all that data goes back and forth between client
and server, not to mention that it's cheesy and old-school.


What do you guys think?  ( Let me know if anything is not clear. )

-Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to