Leszek Gawron wrote:

On Thu, Feb 26, 2004 at 10:22:12AM +0100, Stephan Coboos wrote:


I think a solution like this:

<map:match pattern="first">
<map:call function="getValues" return="true"/>
<map:transform type="jxt"/>
<map:serialize/>
</map:match>





is more easier to understand than this:

<map:match pattern="first">
 <map:call function="getValues"/>
</map:match>

<map:match pattern="second">
 <map:generate type="jxt"/>
 <map:serialize/>
</map:match>

ok, this is possible, too:

<map:match pattern="first">
<map:act type="getValues"/>
<map:transform type="jxt"/>
<map:serialize/>
</map:match>


Not easier to understand at all as you are mixing concerns. With 2 lines of
code you have mixed model and view.



What are the differences between this two solutions?

<map:match pattern="first">
 <map:call function="getValues" return="true"/>
 <map:transform type="jxt"/>
 <map:serialize/>
</map:match>

and

<map:match pattern="first">
        <map:act type="serverpages" src="get_values.xsp">
                <!-- the action puts the values in request attribute and now you can
            use it from within jxtemplate -->
                <map:generate type="jx" src="values.jx"/>
                <map:serialize type="html"/>
        <map:act>
        <map:generate src="failed-to-get-data.xml"/>
        <map:serialize type="html"/>
</map:match>

Therefore I wrote "why not using flowscript like actions"?

Please note the attribute return="true" in the <map:call/>. This tells cocoon what the flow will always return into the sitemap at this position and is not able to use sendPage or sendPageAndWait. I think this would be a possible way to realize integration of flowscript.

What if getValues function fails to fetch the data?

Of course another way could be to to use a construct like this:


<map:match pattern="first">
 <map:act type="flowscript">
    <!-- Do something here -->
 </map:act>
 <map:transform type="jxt"/>
 <map:serialize/>
</map:match>

- BSF (you can use Javascript too) - I do not know what state the BSF block is
 in right now as really nobody used it before.

OK. But this seems to be a problem. I have to use this option in a production environment and therefore it has to be stable.


It should be possible to say: Use flowscript for _all_ your logic problems. The one way should be to use it with sendPage, ... and another way to use it without this functions and instead with a if-else-construct within the pipeline like in actions. So you have one technique which solves the most problems.

Regards
Stephan

Reply via email to