wicket.markup.html.form.RadioGroup and wicket.markup.html.form.Radio
[back to the reference]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.
Behind the Scenes
Example HTML
<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>
Example Code
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);