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.

While with flow it looks like this: 

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

This means that some part of the controller should be initiated

The controler first builds up a data model (your getValues function) and then
basing on it's current state/model content etc. chooses what view to use to
render the data.

Sitemap should only contain controller hooks and the info on how to render the
views. When using flow the sitemap is not the controller any more - if you
used your approach you would have the controller logic spread in two different
places.

What if getValues function fails to fetch the data? 

If you really want to You can always do it like this:

<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>

You have 3 options for your actions:
- pure Java
- XSP 
- 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.

my regards
        lg
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/       [EMAIL PROTECTED]           _\\()//_
         .'/()\'.     Phone: +48(501)720812     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |

Reply via email to