I have a JSF 2.2 form that contains one <h:selectOneMenu>
, inputs and 4 buttons to call CRUD methods. In order to achieve the binding, I used a valueChangeListener
so that when I chose an id
from the <h:selectOneMenu>
, I call a method which updates the object linked to the inputs. The problem is that the inputs don't change their value.
The form
<h:selectOneMenu value="#{avocatBurController.numProf}"
valueChangeListener="#{avocatBurController.handelValueCahnge}" onchange="submit()">
<f:selectItems value="#{avocatBurController.lstAvocatbureau}" var="avcBur"
itemValue="#{avcBur.avocat.numProf}" itemLabel="#{avcBur.avocat.nom}" />
</h:selectOneMenu>
<h:inputText value="#{avocatBurController.avc.prenom}" />
<h:inputText value="#{avocatBurController.avc.nom}" />
...
ManagedBean
public void handelValueCahnge(ValueChangeEvent event) {
String numProf = (String) event.getNewValue();
AvocatBurDao avcBurDao = new AvocatBurDao();
avcBur = avcBurDao.getAvocatBur(numProf);
avc = avcBur.getAvocat();
System.out.println(avc.getNom());
}
avc.getNom()
contains a value but the inputs don't.