How to show multiple tables depending on key in the Map using JSTL?

后端 未结 1 1879
你的背包
你的背包 2021-01-22 17:28

I have a Map of String and List of Object which contains each datacenter and its machine. And I am currently passing this object to JSP from my Controller and then I am iteratin

相关标签:
1条回答
  • 2021-01-22 18:11

    Try this -

    <c:forEach var="e" items="${entry}">
      <h3>For <c:out value="${e.key}"/></h3>
        <table>
          <thead>
                <tr>
                    <th>Machine Name</th>
                    <th>T2_95</th>
                    <th>T2_99</th>
                    <th>Syncs</th>
                    <th>Syncs Behind</th>
                    <th>Average</th>
                </tr>
            </thead>
            <tbody>
              <c:forEach var="m" items="${e.value}">
                <tr>
                  <td>${m.machineName}</td>
                  <td>${m.t2_95}</td>
                  <td>${m.t2_99}</td>
                  <td>${m.syncs}</td>
                  <td>${m.syncsBehind}</td>
                  <td>${m.average}</td>
                 </tr>
               <c:ForEach>
            </tbody>
        </table>
    </c:forEach>
    
    0 讨论(0)
提交回复
热议问题