我有一个这样的列表,为所有用户分配了问题
userId issueNo issue_desc comments
amit t12334 login not happening login via test user not happening
amit t1666 session is not cleared after logout session is not cleared
yash st5436 Transaction Logs check transaction logs
如何使用JSTL实现以下目标?
amit
issueNo issue_desc comments
12334 login not happening login via test user not happening
t1666 session is not cleared after logout session is not cleared
yash
issueNo issue_desc comments
st5436 Transaction Logs check transaction logs
或者有更好的方法可以展示这个吗?
答案 0 :(得分:1)
1)按'userId'排序用户列表;
2)使用下一个周期:
<table>
<thead>
<th>issueNo</th>
<th>issue_desc</th>
<th>comments</th>
</thead>
<tbody>
<c:forEach items="${users}" var="user">
<c:if test="${empty prevUser or user.userId != prevUser.userId}">
<tr>
<td colspan='3' align='left'><c:out value="${user.userId}"/></td>
</tr>
</c:if>
<tr>
<td><c:out value="${user.issueNo}"/></td>
<td><c:out value="${user.issue_desc}"/></td>
<td><c:out value="${user.comments}"/></td>
</tr>
<c:set var="prevUser" value="${user}" />
</c:forEach>
</tbody>
</table>