I have a selectOneMenu with two items"Granted" and "Dismessed"
<p:panelGrid columns="2">
<p:outputLabel value="Result: "/>
<p:selectOneMenu id="omResult" value="#{opcoesMB.result}" style="width: 200px">
<f:selectItem itemLabel="Granted" itemValue="1"/>
<f:selectItem itemLabel="Dismessed" itemValue="2"/>
</p:selectOneMenu>
</p:panelGrid>
I also have two selectOneMenu under that, one of them picks up items from a list called operationRestrictedList, in which case their use would be if the "Granted" item was selected.
<p:selectOneMenu id="omResultGranted" value="#{optionsMB.operationRestricted}" style="width: 200px">
<f:selectItem itemLabel="Select..." itemValue="#{null}"/>
<f:selectItems value="#{optionsMB.restricaoOperacaoList}" var="rest" itemLabel="#{rest.title}" itemValue="#{rest.id}"/>
</p:selectOneMenu>
the other takes a list of items irregularityList call, which would be the case if the item "desmissed" had been selected.
<p:selectOneMenu id="omResultDesmissed" value="#{optionsMB.irregularity}" style="width: 200px">
<f:selectItem itemLabel="Select... " itemValue="#{null}"/>
<f:selectItems value="#{opcoesMB.irregularilityList}" var="irregula" itemLabel="#{irregula.description}" itemValue="#{irregula.id}"/>
</p:selectOneMenu>
well I did not mean it like that, I wanted to have two selectOneMenu only, and the second was set as the item that was selected in the first selectOneMenu, but I have no idea how to do this, I am newbie in jsf, someone could help me give some idea how could I do this?
For do this you just need an listener and update the second selectOneMenu.
XHTML :
And inside your bean you have just to feed your list with the value you needed.
Bean :