
1.5.6
Inspector
Session: 857 bytes
Page: 12.4K
A RadioGroup and Radio components let users select a single value from a group of radio buttons. These components are more flexible then the RadioChoice component in that individual radio choices are full components, unlike with RadioChoice, and thus can be used anywhere in the markup.
<form wicket:id="form">
<span wicket:id="group">
<tr wicket:id="persons">
<td><input type="radio" wicket:id="radio"/></td>
<td><span wicket:id="name">[this is where name will be]</span></td>
<td><span wicket:id="lastName">[this is where lastname will be]</span></td>
</tr>
</span></form>
Form f=new Form("form");
add(f);
RadioGroup group=new RadioGroup("group");
form.add(group);
ListView persons=new ListView("persons", getPersons()) {
protected void populateItem(ListItem item) {
item.add(new Radio("radio", item.getModel()));
item.add(new Label("name", new PropertyModel(item.getModel(), "name")));
item.add(new Label("lastName", new PropertyModel(item.getModel(), "lastName")));
};
group.add(persons);