I am trying to use JSF to retrieve multiple drop down lists according to user input from the view to controller.
However seems I cannot find the correct way.
As the drop down lists are generated dynamically, I cannot hard code the id / name of the drop down list.
Here is my code in the view:
<ui:repeat var="file" value="#{uploadBean.filesInZip}" varStatus="status">
<tr>
<td><h:outputText value="#{file.name}" /></td>
<td>
<h:selectOneMenu id="studentSelections" value="#{uploadBean.studentSelections}" name="studentSelections">
<f:selectItems value="#{uploadBean.students}" var="student"
itemLabel="#{student.firstName}, #{student.lastName} (#{student.userId})"
itemValue="#{student.id}"/>
</h:selectOneMenu>
</td>
</tr>
</ui:repeat>
I thought I could declare a List named studentSelections in the controller so that I could get all the user input of the drop down list, but seems I have failed.
So could anyone give a hand on it?