I have a problem when i use the following drop down list in my page. In detail , when i use the selectOneMenu and press on the button listed below the method save is never called. It just goes through the all the methods i have defined with an f:event only. Once i remove the selectOneMenu from my page and press the save button again, my method is called without any problem.
<p:selectOneMenu id="unitList"
value="#{myController.userDTO.selectedUnitDTO}">
<f:selectItems value="#{myController.unitList}" var="unitList"
itemValue="#{unitList}" itemLabel="#{unitList.name}" />
</p:selectOneMenu>
The drop down list data is loaded by the following method (Note. unitList is initialiazed)
public List<UnitDTO> getUnitList() {
return unitList;
}
My bean has following annotations @ManagedBean @ViewScoped
and this is my button:
<p:commandButton id="save" action="#{myController.save}" value="SAVE" />
Further info, i have noticed that when i press the save button the setter of selectedUnitDTO is never called.
Primefaces Version: 6.0
Converterfor yourUnitDTO? Seems like validation and/or conversion fail, so your setter never gets called. - Tomekh:messagesin your page and you'll most likely see an error (most likely in the log as well). You need a converter in this case. The itemValue is a String when it is posted back to the server, not an object. Try with a plain jsf selectOneMenu, same problem! - Kukeltje