Hi, I'm pretty new to Wicket and trying to get a better understanding of how models work. That's probably why this is such a tricky problem for me.
On my site, users are submitting a form for a new Issue to be created. One of the fields of this Issue is affectedParties; in the data model, this is represented by a collection of PartyIssue objects, which associate a Party with an Issue. Here's the simplified code: public class Issue { ... private Set <PartyIssue> affectedParties; public Set <PartyIssue> getAffectedParties () { ... } public void setAffectedParties (Set <PartyIssue> affectedParties) { ... } ... } public class Party { ... } public class PartyIssue { private Issue issue; private Party party; ... } The new Issue Form uses a new Issue object as the argument for the CompoundPropertyModel. What I want to do is allow users to specify the affected parties by multi-selecting from a list of Parties. Then, at the time of submission, we should iterate through this list and construct corresponding PartyIssues, which are associated with the Issue and then created by the service layer (with validation etc.). So, how would I do this? This is how I've been trying to construct the ListMultipleChoice: private Set <Party> affectedParties = new HashSet <Party> (); private ListMultipleChoice <Party> buildPartyDropdown (String property) { IModel <Collection <Party>> affectedPartyModel = new IModel <Collection <Party>> () { @Override public Collection <Party> getObject () { return affectedParties; } @Override public void setObject (Collection <Party> arg0) { affectedParties.clear (); affectedParties.addAll (arg0); } @Override public void detach () { // Nothing to do here } }; IChoiceRenderer <Party> partyListRenderer = new IChoiceRenderer <Party> () { private static final long serialVersionUID = -1588547331340300417L; @Override public Object getDisplayValue (Party arg0) { return arg0.getFullName (); } @Override public String getIdValue (Party arg0, int arg1) { return Long.toString (arg0.getRecordId ()); } }; ListMultipleChoice <Party> choice = new ListMultipleChoice <Party> (property, affectedPartyModel, new Vector <Party> (getAllParties ()), partyListRenderer); return choice; } In my onSubmit() code for the Form, I attempt to iterate through the affectedParties Set to create the Set of PartyIssues. However, this is always turning out to be empty no matter what is selected on the form. The problem isn't in the onSubmit() code because the rest of the form is processed and persisted properly, and log messages show that affectedParties is empty at that point. Note that the list choices are being rendered properly. I'm sure I'm doing something very wrong so I'd appreciate any guidance.