I have a JSF page with the following radio button definition:
<h:selectOneRadio id="durationList" value="#{rentalEquipmentCheckoutController.selectedDuration}" styleClass="durationList">
<f:selectItems var="d" value="#{rentalEquipmentCheckoutController.durationList}" itemValue="#{d}" itemLabel="#{d.label}">
</f:selectItems>
<f:converter converterId="durationConverter" />
<f:ajax />
</h:selectOneRadio>
I have a convertor that seems to be working fine. I have stepped through it and it is doing what it is supposed to be doing on get and set.
@Override
public Object getAsObject(FacesContext context, UIComponent component, String durationHours) {
RentalDuration rentalDuration = DurationFactory.getDuration(Integer.parseInt(durationHours));
return rentalDuration;
}
@Override
public String getAsString(FacesContext context, UIComponent component, Object object) {
if (object != null) {
RentalDuration duration = (RentalDuration) object;
return Integer.toString(duration.getHours());
}
return "Error";
}
The controller is a ManagedBean and it is view scoped. The list appears fine on the UI and all of the values appear to be working in google web dev tools. When I click on one of the radio buttons, the convertor's getAsObject fires and returns the correct instance of RentalDuration. The setSelectedDuration method in the bean is never called though. I tried just setting up a simple implementation with a list of Strings, and that seems to work just fine (same page, bean etc). The setTestString method is called. I have read so many of @BalusC's posts that my eyes are bleeding, but I cannot seem to figure out what I am doing wrong.