からitemvalueを取得するにはどうすれば<f:selectedItems>
はselectonemenu JSF
からitemValueを取得する必要があり、これはこれは私がデータベース
private List<NegaraEntity> listNegara;
private int countryID;
@PostConstruct
public void init()
{
listNegara = negaraRules.getNegara();
}
からデータを取得している私のbackingBean 私の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>
とあります私は<f:selectedItem>
からIDを取得したいので、sytem.out.println
このように
public void test(int ctyId)
{
ctyId = countryID;
System.out.println(ctyId);
}
これは機能しません。
ありがとうございました。
感謝すること – Pyon