如何使用 JSTL 遍历列表

How to iterate through Lists using JSTL

我有一个这样的列表,为所有用户分配问题

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

或者有什么更好的方法可以显示它吗?

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>