The problem is, that actually the bean does not hold the selected value because of readonly="true"
. When you apply that property to an UIInput the UIInput will not be processed on a submit.
To fix this you can do the following:
If you use JSF2 you can use readonly="#{facesContext.renderResponse}"
instead.
If not, define a method isReadonly
on your backing bean and use readonly="#{myView.isReadonly}"
.
public boolean isReadonly() {
return FacesContext.getCurrentInstance().getRenderResponse();
}
Have a look at the following similiar question and especially the answer for more details on why this works: Data in <h:inputText readonly="true"> disappears when command button is clicked