【发布时间】:2017-05-15 04:03:14
【问题描述】:
如何生成具有动态行和列的动态数据表? 行和列是基于后端值动态的。 2,3,4 列将是学期-学科组合列表的列表,用于存储所选值。
我知道这可以通过 primefaces 来实现。但是有没有办法不使用任何库,而是使用 jsf 2.2 实现这一点?
我的代码在一行中生成学期主题列表。
<table>
<thead>
<tr>
<th>Enrollment</th>
<c:forEach items="#{semesterTO.getSubjects()}" varStatus="loop"
var="subjects" id="subjectsId">
<th>#{subjects.Name}</th>
</c:forEach>
</tr>
</thead>
<tbody>
<c:forEach items="#{semesterTO.getSemesters()}" var="semester"
varStatus="status1">
<tr>
<td><h:outputText value="#{semester.semesterId}" /></td>
</tr>
</c:forEach>
<c:forEach items="#{semesterTO.subjectSemesterList()}" var="a"
varStatus="status2">
<tr>
<td><h:selectBooleanCheckbox
value="#{semesterTO.enrolledSubjects[a]}" /></td>
</tr>
</c:forEach>
</tbody>
</table>
【问题讨论】: