You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Joose Vettenranta <jo...@iki.fi> on 2005/09/09 10:01:33 UTC
forms + binding in repeater + bean + String[] type
Hi,
I have bean like this:
class Bean {
private Collection foo = new ArrayList();
public addItem (String[] item) {
ths.foo.add(foo);
}
public getFoo() {..}
..
}
in binding file, is iti possible to bind to that datatype, or do I
have to use some wrrapper class?
like
<fb:repeater id="foo" parent-path="." row-path="foo">
<fb:identity>
<fb:value id="id" path="String[0]"/>
</fb:identity>
<fb:on-bind>
<fb:value id="value1" path="String[1] direction="load"/>
<fb:value id="value2" path="String[2]"/>
</fb:on-bind>
?
- Joose
--
"Always remember that you are unique, just like everyone else!"
* http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: forms + binding in repeater + bean + String[] type
Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Sep 9, 2005, at 1:01 AM, Joose Vettenranta wrote:
> Hi,
>
> I have bean like this:
>
> class Bean {
> private Collection foo = new ArrayList();
>
> public addItem (String[] item) {
> ths.foo.add(foo);
> }
>
> public getFoo() {..}
> ..
> }
>
> in binding file, is iti possible to bind to that datatype, or do I
> have to use some wrrapper class?
>
> like
> <fb:repeater id="foo" parent-path="." row-path="foo">
> <fb:identity>
> <fb:value id="id" path="String[0]"/>
> </fb:identity>
>
> <fb:on-bind>
> <fb:value id="value1" path="String[1] direction="load"/>
> <fb:value id="value2" path="String[2]"/>
> </fb:on-bind>
You have to have a bean property to bind to. You've got a getFoo(),
but you also need a setFoo() for foo to be a property. Unless you are
heinously overloading "foo" in your example above :-), you would not
set repeater@row-path to 'foo' (and let's not call the repeater 'foo',
too! :-).
"String[0]" etc. are not going to be valid jxpath components either
(because that would have to map to a property named 'String'). What
you want is "foo[0]", "foo[1]", etc. â corresponding to the 'foo' that
is Bean.foo (forget all those other 'foo's! :-)
cheers,
âmlâ
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org