cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <>
Subject Re: "Remove" problems with the Woody sample
Date Tue, 09 Sep 2003 09:04:52 GMT
On Sat, 2003-09-06 at 13:39, Hugo Burm wrote:
> This is about the "Bean Binding" sample on the Woody samples page, and the
> "Remove" option of the Contacts on this page.
> (Cocoon version: 2.1.2, one day after the release of 2.1.1)
> 1)
> If I have more than one Contact (e.g. by adding the lines
>     contact = new;
>     contact.setId("2");
>     contact.setFirstName("Hugo");
>     bean.addContact(contact);
> to the "form2bean" function in "binding_example.js"),
> I cannot delete more than one at a time. When I check two Contacts, Click on
> "Remove selected contacts", then only one of them is removed.

You mean that only one is removed _after performing the binding_, right?
They are both removed from the repeater-widget, but there's something
wrong in the repeater binding indeed. It doesn't work for binding to XML
documents either.

This seems to be caused by the classical problem when removing items
from a list while running through it.

I've tried to solve this by first storing the JXPathContexts of the
items to delete in a seperate list, and then running backwards through
that list, and it seems to work all right. Will commit this soon.

Thanks for reporting this problem!

> 2)
> The Contacts are not removed from the ArrayList. By the Remove option, all
> relevant keys of the Contact are set to null, so you will never see it again
> in this context.  But the item is not removed from the list. This is a
> problem if you have a persistence framework flushing the list to hard disk
> (zombie records in your database).

Not sure that I follow here: I suppose that if I don't see the item
anymore on jx-generated page, it really isn't in the arraylist anymore?

> I checked the Woody source. I guess it must be the JXPath removePath() in
> What is this removePath() supposed to do?

Remove the addressed path. If it addresses an item in a collection, it
means removing the item from the collection.

Bruno Dumon                   
Outerthought - Open Source, Java & XML Competence Support Center                

View raw message