HI,
I am trying to make a 'simple' DropDownChoice in a form for a class
called region,
but when I push the submit Wicket does not understand how to convert
it back to
the Region class. (see below for code sample)
Does anyone have a hint? Or maybe sample code?
Harrie
The Region class is basically a class that combines an id with a name.
public class Region {
private long id;
private String name;
public long getId() {
return id;
}
public String getName() {
return name;
}
}
The drop down goes correctly with the code below. The options in the
select box have the correct name and ids.
public class RegionDropDownChoice extends DropDownChoice<Region> {
@SpringBean
private RegionService regionService;
public RegionDropDownChoice(String id, List<Region> regionList) {
this(id, false, regionList);
}
public RegionDropDownChoice(String id, boolean nullValid,
List<Region> regionList) {
super(id);
setType(Region.class);
setNullValid(nullValid);
setChoiceRenderer(new ChoiceRenderer<Region>() {
public Object getDisplayValue(Region Region) {
return Region.getName();
}
@Override
public String getIdValue(Region Region, int index) {
return Region.getName();
}
});
setChoices(regionList);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]