【发布时间】:2012-12-06 05:57:58
【问题描述】:
我正在尝试使用 JSF 根据从视图到控制器的用户输入来检索多个下拉列表。
但是我似乎找不到正确的方法。
由于下拉列表是动态生成的,我无法硬编码下拉列表的 ID/名称。
这是我在视图中的代码:
<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>
我以为我可以在控制器中声明一个名为 studentSelections 的列表,以便我可以获得下拉列表的所有用户输入,但似乎我失败了。
那么有人可以帮忙吗?
【问题讨论】: