cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giacomo Pati <>
Subject Re: generator based including
Date Fri, 12 Jan 2001 19:31:59 GMT
Jeremy Quinn wrote:
> At 22:59 +0100 11/01/01, Giacomo Pati wrote:
> >> This is how a set of forms are defined. The form:handler checks the POST
> >> data and chooses (based on the input validation) the right form to be shown.
> >> So we have the a main XSP page that includes another XSP page.
> >> (Of course the including is hidden inside the form:taglib)
> >
> >What you are doing here is mixing service (controller) and presentation
> >layer (view). My advice is *DON'T DO IT*. You'll soon find yourself in
> >troubles and you are trying to solve it with the wrong approach because
> >yyou are already too deep into it. Instead you should strictly separate
> >these layers. This is one reason why the sitemap with the different
> >components exists.
> >
> >The approach I use is that I have XML/XSP files which represents the
> >views of my application model (only read access). I write actions for
> >the form data validation/processing and the write access to the model
> >(actions in fact are for your business logic or at least adapt them).
> >And finally let the actions communicate with the other components
> >(matcher/selector/generator etc.) using the mechanisms the sitemap
> >offers by returning map values from the actions and use them in src
> >attributes for your generators. Or use a selector which has the
> >knowledge between conditions your actions set and the resources that
> >should be produced based upon these condiftion. That way you don't have
> >to bind your action directly with your resources.
> This is very interesting, I am trying to grasp how our CRUDLET project will
> migrate to Cocoon 2 ..... do you have some examples of your techniques you
> can distribute?

Look at the "Manage Employees" samples that come with C2. There you find
how to use actions to modify your model. You can go on and tell the
sitemap (by returning a HasMap) which is the resource that should be
generated as next.

If you look at Torsten Curdts samples of his form taglib he is doing
exacly that in the XSP page (and thus has the problem to tell the xsp
page who it in fact is ;). Take his approach and try to move that logic
into actions and use the capabilities of the sitemap like this:

  <map:act set="my-action-set">
    <map:generate src="{nextscreen}"/>

One actions in your set should return a HashMap with a entry named
"nextscreen" with the content of a resource for your generator.
Additionally your action can use the Servlet mechanisms to comunicate
with your XSP page. An action sets a request attribute and the XSP reads
it (i.e. to display a message an action wants to forward to the


> regards Jeremy
> --
>    ___________________________________________________________________
>    Jeremy Quinn                                           Karma Divers
>                                                        webSpace Design
>                                             HyperMedia Research Centre
>    <>                    <>
>     <phone:+44.[0].20.7737.6831>        <>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, email:

View raw message