in this case 'autoGenerateSubjectKey' should contain "Yes" or "No" to be selected.
You could change the property type of 'autoGenerateSubjectKey' from Boolean to String, but i think it is better to change the type of the choices to Boolean: List<Boolean> list = new ArrayList<Boolean>(); list.add(Boolean.TRUE); list.add(Boolean.FALSE); IChoiceRenderer<Boolean> choiceRederer = new IChoiceRenderer<Boolean>() { /** serialVersionUID */ private static final long serialVersionUID = 1L; /** * @see org.apache.wicket.markup.html.form.IChoiceRenderer#getDisplayValue(java.lang.Object) */ public Object getDisplayValue(final Boolean b) { String displayValue = "No"; if (b != null && b.booleanValue()) { displayValue = "Yes"; } return displayValue; } /** * @see org.apache.wicket.markup.html.form.IChoiceRenderer#getIdValue(java.lang.Object, int) */ public String getIdValue(final Boolean object, final int index) { return object.toString(); } }; PropertyModel<Boolean> propertyModel = new PropertyModel<Boolean>(study,"autoGenerateSubjectKey"); return new RadioChoice<Boolean>(radioChoiceId,propertyModel,list,choiceRenderer); 2010/7/12 Nivedan Nadaraj <shravann...@gmail.com> > Hi All > > The problem: > > This seems pretty basic but I have some issues when I want the UI to be set > with the value from the Model. Any pointers would be great. > > My Model has a property of type Boolean.On the UI I represent this as Yes > and No using RadioChoice. When I perist this enitity, > the Yes is converted into a boolean and then persisted in the database. > > However when the page refreshes, the radio buttons loosed their > pre-selected/selected values.I guess its around the Model that I have gone > wrong. > > List<String> list = new ArrayList<String>(); > list.add("Yes"); > list.add("No"); > > PropertyModel propertyModel = new > PropertyModel(study,"autoGenerateSubjectKey"); //study is the Entity and > has > a property autoGenerateSubjectKey > return new RadioChoice<String>(radioChoiceId,propertyModel,list); > > Thank you > Regards > Niv >