Use some sort of repeater over your collection, then add the individual form
components inside that.
add(new ListView("phones") {
@Override
protected void populateItem(ListItem item) {
item.setModel(new CompoundPropertyModel(item.getModel()));
item.add(new TextField(""));
}
});
<ul>
<li wicket:id="phones">
<input type="text" wicket:id="number" />
</li>
</ul>
--
Jeremy Thomerson
http://www.wickettraining.com
On Mon, Oct 13, 2008 at 6:45 PM, Cristina <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I'm working on an application that will have a simple Form in front of a
> rather complex object graph. I'm using JPA implemented by Hibernate at the
> persistence layer.
>
> In an effort to keep things simple I'm using CompoundPropertyModel in the
> Form constructor:
>
> Person p = session.getCurrentPerson();
> setModel(new CompoundPropertyModel(p));
>
> CompoundPropertyModel allows me to easily define anonymous TextFields to
> capture the new values of plain and object attributes of Person:
>
> add(new TextField("lastName");
> // ...
> add(new TextField("address.city");
>
> Now suppose Person has an attribute whose type is a collection:
>
> private List<Phone> phones;
>
> How can I access all phones in the collection and then generate the
> corresponding TextFields for the two (or more) Phone attributes?
>
> Thanks so much,
>
> Cristina
>
> --
> View this message in context:
> http://www.nabble.com/CompoundPropertyModel-and-collection-attributes-tp19964896p19964896.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>