Im getting this error:
CheckGroup contains a null model object, must be an object of type java.util.Collection
Im not sure what is causing this issue, nor can anyone in my team resolve this.
Ive had to redact this as it contains business related items.
Java:
Form<?> form = new Form<Object>("myform");
add(form);
CheckGroup<?> checkGroup = new CheckGroup<Object>("checkgroup");
form.add(checkGroup);
checkGroup.add(new CheckGroupSelector("groupselector"));
listView = new ListView<info>("listView", sessionObject.getList())
{
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<info> item)
{
item.add(new Check("recordSelected", item.getModel()));
item.add(new Label("IDListItem", new PropertyModel<String>(item.getModel(), "Number")));
}
};
checkGroup.add(listView);
HTML:
<table wicket:id="checkgroup">
开发者_如何学Python <tr>
<td width="20"><input wicket:id="groupselector" type="checkbox" /></td>
<td width="80"><b>Number</b></td>
</tr>
<tr wicket:id="listView">
<td width="20"><input wicket:id="recordSelected" type="checkbox" /></td>
<td width="80"><span wicket:id="IDListItem"></span></td>
</tr>
</table>
Looks like you are following an example from wicketstuff.org. But that example is incomplete as it doesn't pass a model to CheckGroup. Igor Vaynberg mentioned in the Wicket user forums, that a compound model was used [1].
So pass a model and you'll be fine.
Try using a dummy model e.g.
CheckGroup<?> checkGroup = new CheckGroup<Object>("checkgroup", new ArrayList<Object>());
Javadoc says:
Constructor that will create a default model collection
when using 1-arg constructor, but I don't see where this default model collection is created in the code...
You should set the model in use place. example code:
CheckGroup targetsGroup = new CheckGroup<>("targets", new ArrayList<City>());
精彩评论