cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomason <thoma...@physio1.utmem.edu>
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 christian@schlichtherle.de
wrote:
> + 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
     director.protocol#.section.sheet.bind
     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
  </map:call>
</map:match>

<!-- binding template to bind the data to the form. The call is
     bindtemplate.bindform.protocol#
     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"/>
</map:match>

<!-- 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:when>
    <map:otherwise>
      <map:serialize type="html"/>
    </map:otherwise>
  </map:select>
</map:match>

<!-- pipeline to process the form template. The call is
     formtemplate.form.protocol#
     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"/>
</map:match>


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

Best,
Don




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message