cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomason <>
Subject Re: Cocoon Forms vs. JSF
Date Mon, 04 Jun 2007 15:14:02 GMT
on 6/4/07 8:52 AM, Christian Schlichtherle at
> + On the other hand, I foresee productivity scalability issues: Suppose I
> need to do ten forms. With Cocoon Forms, I would have to do ten Form
> Definitions, plus ten JXTemplates, plus the controller logic plus a plethora
> of pipeline definitions in sitemap.xmap. This doesn't scale very good and
> uses a mix of very distinct technologies.

I don't find it nearly so daunting. The samples show good examples of
pipeline reuse (for concise coding). So all templates can go through a
*_template pipeline, all bindings through a *_bind pipeline, etc. The
controller logic can be a single function to handle all forms.

For example:
<!-- bind existing data to an editable form. The call is
     The bindform is in the forms directory and has the name
     'sheet'_bind.xml -->
<map:match pattern="*.*.*.*.bind">
  <map:call function="handleForm">
    <map:parameter name="function" value="formedit"/>
    <map:parameter name="definitionURI" value="forms/{4}.xml"/> <!--model-->
    <map:parameter name="bindingURI" value="cocoon:/bindtemplate.{4}.{2}"/>
    <map:parameter name="validateURI" value="{1}.{2}.{3}.{4}.validate"/>
    <!-- return here until controller detects flag condition -->
    <map:parameter name="returnURI" value="{1}.{2}.{3}.{4}.bind"/>
    ... other named parameters

<!-- binding template to bind the data to the form. The call is
     The bindform is in the forms directory and has the name
     'bindform'_bind.xml -->
<map:match pattern="bindtemplate.*.*">
  <map:generate src="forms/{1}_bind.xml"/> <!-- binding -->
  ... transform the binding, if needed
  <map:serialize type="xml"/>

<!-- ShowPageAndWait pipeline to validate data. The call is from the binding
     flowscript in the form director.protocol#.section.sheet.validate -->
<map:match pattern="*.*.*.*.validate">
  <map:generate src="cocoon:/formtemplate.{../4}.{../2}" type="newjx"/>
  <map:transform type="browser-update"/>
  <map:transform type="forms"/>
  ... styling and other transformations
  <map:select type="ajax-request">
    <map:when test="true">
      <map:serialize type="xml"/>
      <map:serialize type="html"/>

<!-- pipeline to process the form template. The call is
     The form is in the forms directory and named 'form'_template.xml -->
<map:match pattern="formtemplate.*.*">
   <map:generate src="forms/{1}_template.xml"/> <!-- template -->
   ... transform the template, if needed
   <map:serialize type="xml"/>

I have use this strategy to process dozens of forms. Presumably, each of
your 10 forms has different data, so generating models, bindings, and
templates will have to be unique (unless there is enough similarity to
process it through a pipeline, as above).


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message