我想从价值。 我tryed这个代码,但它不工作:
<h:form>
<h:outputLabel value="départements : "/>
<h:selectOneMenu value="#{departementController.selected.id}" onchange="submit()" immediate="true">
<f:valueChangeListener type="Controller.Listener.DepartementValueListener"/>
<f:selectItems value="#{departementController.itemsAvailableSelectOne}"/>
</h:selectOneMenu>
<h:outputLabel value="nouvelle valeur : "/>
<h:inputText value="#{departementController.comboBox}" id="dep"/>
</h:form>
控制器:
//departement change listener
private String comboBox;
public String getComboBox() {
return comboBox;
}
public void setComboBox(String comboBox) {
this.comboBox = comboBox;
}
public void departementChangeListener(ValueChangeEvent e) {
// Skip validation of non-immediate components and invocation of the submit() method.
FacesContext.getCurrentInstance().renderResponse();
this.comboBox = e.getNewValue().toString();}
的SourceID = j_idt7:j_idt9 [严重性=(ERROR 2)摘要=(j_idt7:。j_idt9验证错误值不正确)=细节(j_idt7:j_idt9:验证错误值不正确。)]