You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Stefan Klein <kl...@web.de> on 2004/03/02 15:57:49 UTC

limitation in woody-repeater binding and collections

Hi, 
 
here's an issue I came across the other day and it took me quite a while to figure out, so I thought 
I'd let everyone know and maybe someone could include a note in the WoodyBinding 
documentation on the wiki: 
 
I had a bean with a Collection of type HashSet which I was trying to bind to a Woody Form. 
Reading it worked perfectly, updating, too. But inserting a couple of new elements at a time 
caused a problem: The binding seemed to save only some elements and create empty collection 
elements (no values set) for others. 
 
Tracing the problem through the woody code, I realised that the code implies the use of ordered 
collections such as LinkedList, ArrayList...  
Woody first creates a new element instance and adds it to the collection. It then obtains it from 
the collection using jxpath syntax "mybean/collection[count]" to fill in the values. "count" is the 
new number of elements in the collection (after insertion) which assumes that the new element 
has been added at the end. This is true for Lists, but not for my HashSet. So, in fact, any odd 
element would be retrieved, possibly the new one and possibly not. That produced an 
unpredictable behaviour where element values would be overwritten and others left blank. 
 
Maybe that could be pointed out more clearly on the wiki page where it only says that the property 
has to be of type Collection. Might save others some time. 
 
Thanks 
Stefan 
______________________________________________________________________________
Nachrichten, Musik und Spiele schnell und einfach per Quickstart im 
WEB.DE Screensaver - Gratis downloaden: http://screensaver.web.de/?mc=021110


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


Re: limitation in woody-repeater binding and collections

Posted by Jan Hoskens <jh...@schaubroeck.be>.
That's good to know! That does have to be on the docs. You can always edit
the pages by yourself if you want to, they are Wiki's after all.

Kind Regards,
Jan
----- Original Message ----- 
From: "Stefan Klein" <kl...@web.de>
To: <us...@cocoon.apache.org>
Sent: Tuesday, March 02, 2004 3:57 PM
Subject: limitation in woody-repeater binding and collections


> Hi,
>
> here's an issue I came across the other day and it took me quite a while
to figure out, so I thought
> I'd let everyone know and maybe someone could include a note in the
WoodyBinding
> documentation on the wiki:
>
> I had a bean with a Collection of type HashSet which I was trying to bind
to a Woody Form.
> Reading it worked perfectly, updating, too. But inserting a couple of new
elements at a time
> caused a problem: The binding seemed to save only some elements and create
empty collection
> elements (no values set) for others.
>
> Tracing the problem through the woody code, I realised that the code
implies the use of ordered
> collections such as LinkedList, ArrayList...
> Woody first creates a new element instance and adds it to the collection.
It then obtains it from
> the collection using jxpath syntax "mybean/collection[count]" to fill in
the values. "count" is the
> new number of elements in the collection (after insertion) which assumes
that the new element
> has been added at the end. This is true for Lists, but not for my HashSet.
So, in fact, any odd
> element would be retrieved, possibly the new one and possibly not. That
produced an
> unpredictable behaviour where element values would be overwritten and
others left blank.
>
> Maybe that could be pointed out more clearly on the wiki page where it
only says that the property
> has to be of type Collection. Might save others some time.
>
> Thanks
> Stefan
>
____________________________________________________________________________
__
> Nachrichten, Musik und Spiele schnell und einfach per Quickstart im
> WEB.DE Screensaver - Gratis downloaden:
http://screensaver.web.de/?mc=021110
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


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


Re: limitation in woody-repeater binding and collections

Posted by Joerg Heinicke <jo...@gmx.de>.
On 02.03.2004 15:57, Stefan Klein wrote:

> Maybe that could be pointed out more clearly on the wiki page where it only says that the property 
> has to be of type Collection. Might save others some time. 

IMO this should be fixed in Woody directly. Either by assuring that an 
ordered collection is provided or by extending the current code to 
handle all types of collections.

Can you add a bug to bugzilla for it.

Joerg

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