j'ai besoin de ItemValue obtenir de <f:selectedItems>
Comment ItemValue obtenir de selectonemenu JSF
c'est mon xhtml
<h:form>
<h:panelGrid columns="3" cellpadding="5">
<p:outputLabel for="negara" value="Negara"></p:outputLabel>
<p:selectOneMenu id="negara" value="#{propinsiBacking.countryID}">
<f:selectItems value="#{propinsiBacking.listNegara}" var="negara" itemLabel="#{negara.countryName}" itemValue="#{negara.countryID}"></f:selectItems>
</p:selectOneMenu>
<p:commandButton value="Go" action="#{propinsiBacking.test}"></p:commandButton>
</h:panelGrid>
</h:form>
et mon backingBean c'est-je obtenir des données de base de données
private List<NegaraEntity> listNegara;
private int countryID;
@PostConstruct
public void init()
{
listNegara = negaraRules.getNegara();
}
et je veux obtenir l'ID de <f:selectedItem>
donc je sytem.out.println
comme ça
public void test(int ctyId)
{
ctyId = countryID;
System.out.println(ctyId);
}
mais cela ne fonctionne pas, aucune idée?
merci pour l'aide.
merci :-) il a travaillé – Pyon