John John - 1 year ago 126
Java Question

Wicket and Java: CheckGroup contains a null model object

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.


Form<?> form = new Form<Object>("myform");
CheckGroup<?> checkGroup = new CheckGroup<Object>("checkgroup");
checkGroup.add(new CheckGroupSelector("groupselector"));
listView = new ListView<info>("listView", sessionObject.getList())
private static final long serialVersionUID = 1L;

protected void populateItem(ListItem<info> item)
item.add(new Check("recordSelected", item.getModel()));
item.add(new Label("IDListItem", new PropertyModel<String>(item.getModel(), "Number")));


<table wicket:id="checkgroup">
<td width="20"><input wicket:id="groupselector" type="checkbox" /></td>
<td width="80"><b>Number</b></td>
<tr wicket:id="listView">
<td width="20"><input wicket:id="recordSelected" type="checkbox" /></td>
<td width="80"><span wicket:id="IDListItem"></span></td>

Answer Source

Looks like you are following an example from 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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download