You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Sebastien Arbogast <se...@gmail.com> on 2005/05/06 17:55:49 UTC

CForms, repeater, binding and POJO's

Hi,

Does someone know where I can find a simple sample CForm with a
repeater to edit a list of POJO's using the binding framework ?
Because in samples the binding is made from a XML file and I can't
figure out how to adapt it.
In fact what I would like to do is quite simple :
- load the repeater-based form definition
- load a list of POJO's from flowscript
- bind this list to my repeater-based form definition
- send page as usual with CForms.

Any ideas ?

Thx in advance...
-- 
Sebastien ARBOGAST

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


Re: CForms, repeater, binding and POJO's

Posted by Sebastien Arbogast <se...@gmail.com>.
OK this sample is definitely not what I'm looking for. I don't
understand how JXPath works and I can't figure out how I can edit a
simple bean LIST. Not just one, but a list of them. I don't even need
a repeater in fact because I don't want my beans to be editable
directly in the list and I don't want to add or remove them directly
in the list. I just want to load a java.util.List and display a form
with one bean represented in each row, the first column being a
selection checkbox, the second one a representative property and the
third one containing a list of applicable actions.
A good example of what I would like to achieve is the applications
list in tomcat manager main page, each application being one of my
beans.

Any idea of how I could do that simply ? Is it better to use CForms
(because I'm beginning to wonder if it's possible with CForms) or
should I just make a JX Template with a for loop ?

WDYT ? I really need your help. It's one of the last obstacles on my
project's road to success :-P

Pleaaaase... help...

2005/5/6, Sebastien Arbogast <se...@gmail.com>:
> Ok thank you very much. It doesn't seem to be exactly what I'm looking
> for but it's a start anyway. At least it should help me understand the
> binfing framework a little better.
> 
> But first of all where does the handleForm function come from ? I
> didn't find it in any flowscript file imported, and still it is called
> in sitemap :
> 
> <map:match pattern="form2bean.flow">
>        <map:call function="handleForm">
>          <map:parameter name="function" value="form2bean"/>
>          <map:parameter name="form-definition" value="forms/form2_model.xml"/>
>          <map:parameter name="bindingURI" value="forms/form2_bind_bean.xml"/>
>        </map:call>
>      </map:match>
> 
> If I could understand where this function comes from I would be able
> to figure out what is its "form" parameter and how it's used that
> way...
> 
> Any idea ?
> 
> --
> Sebastien ARBOGAST
> 


-- 
Sebastien ARBOGAST

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


Re: CForms, repeater, binding and POJO's

Posted by Ben Pope <be...@gmail.com>.
Sebastien Arbogast wrote:
>>cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
>>\src\blocks\forms\java\org\apache\cocoon\forms\flow\javascript\Form.js
> 
> 
> First of all thank you for your answers Jens : you help me very much
> despite the fact that my questions don't seem to be very popular.
> Anyway now I have a more specific issue concerning path values in binding file.
> In the form2bean sample and in the documentation it's assumed that I
> have some root bean with a collection member :
> 
> For beans: if your bean has a property "things" which is a Collection
> [or whathever JXPath supports as lists], then the parent-path should
> simply contain "." and the row-path "things".
> 
> But in my example I intend to load the collection itself (if possible)
> and bind it to "/". Is it possible or do I have to wrap my collection
> into an artificial bean ? If it's possible as is, what should I put in
> parent-path and row-path attribute for fb:repeater ?

I have only used binding to XML, but form what I can tell, you must have a parent, so you would need to wrap it and point parent-path to it.

Ben

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


Re: Re[2]: CForms, repeater, binding and POJO's

Posted by Sebastien Arbogast <se...@gmail.com>.
> cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
> \src\blocks\forms\java\org\apache\cocoon\forms\flow\javascript\Form.js

First of all thank you for your answers Jens : you help me very much
despite the fact that my questions don't seem to be very popular.
Anyway now I have a more specific issue concerning path values in binding file.
In the form2bean sample and in the documentation it's assumed that I
have some root bean with a collection member :

For beans: if your bean has a property "things" which is a Collection
[or whathever JXPath supports as lists], then the parent-path should
simply contain "." and the row-path "things".

But in my example I intend to load the collection itself (if possible)
and bind it to "/". Is it possible or do I have to wrap my collection
into an artificial bean ? If it's possible as is, what should I put in
parent-path and row-path attribute for fb:repeater ?

-- 
Sebastien ARBOGAST

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


Re[2]: CForms, repeater, binding and POJO's

Posted by Jens Maukisch <co...@maukisch.net>.
Hi Sebastien,

> But first of all where does the handleForm function come from ? I
> didn't find it in any flowscript file imported, and still it is called
> in sitemap :

cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");

\src\blocks\forms\java\org\apache\cocoon\forms\flow\javascript\Form.js

-- 
* best regards
* Jens Maukisch              


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


Re: CForms, repeater, binding and POJO's

Posted by Sebastien Arbogast <se...@gmail.com>.
Ok thank you very much. It doesn't seem to be exactly what I'm looking
for but it's a start anyway. At least it should help me understand the
binfing framework a little better.

But first of all where does the handleForm function come from ? I
didn't find it in any flowscript file imported, and still it is called
in sitemap :

<map:match pattern="form2bean.flow">
       <map:call function="handleForm">
         <map:parameter name="function" value="form2bean"/>
         <map:parameter name="form-definition" value="forms/form2_model.xml"/>
         <map:parameter name="bindingURI" value="forms/form2_bind_bean.xml"/>
       </map:call>
     </map:match>

If I could understand where this function comes from I would be able
to figure out what is its "form" parameter and how it's used that
way...

Any idea ?

-- 
Sebastien ARBOGAST

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


Re: CForms, repeater, binding and POJO's

Posted by Jens Maukisch <co...@maukisch.net>.
Hi Sebastien,

> Hi,

> Does someone know where I can find a simple sample CForm with a
> repeater to edit a list of POJO's using the binding framework ?
> Because in samples the binding is made from a XML file and I can't
> figure out how to adapt it.

There are samples with beans too.

> In fact what I would like to do is quite simple :
> - load the repeater-based form definition
> - load a list of POJO's from flowscript
> - bind this list to my repeater-based form definition
> - send page as usual with CForms.

hava a look at
build\webapp\samples\blocks\forms\flow\binding_example.js
function form2bean(form) ...
and
build\webapp\samples\blocks\forms\forms\form2_bind_bean.xml

--> http://localhost:8888/samples/blocks/forms/form2bean.flow


-- 
* best regards
* Jens Maukisch              


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