I have this new problem. I have the following code in JSF 2.0 with Primefaces 2.2.1:
<h:selectOneMenu id="cmbRole8" value="#{myWorkflow.posToInsert[7]}" >
<f:selectItem itemLabel="Select a position..." itemValue="-1" />
<f:selectItems value="#{appPositions.allPositions}" var="ap"
itemLabel="#{ap.roDescription}" itemValue="#{ap.roPositionid}" />
</h:selectOneMenu>
This is repeated 7 more times for a total of 8 selectOneMenu controls where I need to get user input. Obviously this doesn’t work because the getters and setters don’t know which index to use when assigning the values. How can I achieve this properly?
This is not true. Your problem is probably caused because you didn’t preinitialize the array yourself. JSF/EL namely won’t do it for you (like as with every other “nested object”). It will only set the array value by the given index.
E.g.
with