JSTL中如何循环LinkedHashMap的List并获取Key和Values
How to Loop the List of LinkedHashMap and get Key and Values in JSTL
我的 java class 正在返回类似 List>> 的值。在 JSTL 中,如何打印 LinkedHashMap 键和列表。
<c:forEach var="row" items="${myList.data}"> // Main List
<DIV>
<span option="1">${row.key}</span> // Getting empty key
</DIV>
</c:forEach>
what is .data if it is list ? I think .data will not come.Your loop should be like this
<c:forEach items="${myList}" var="map">
<c:forEach var="entry" items="${map}">
<tr><td><c:out value="${entry.key}"/></td> <td><c:out value="${entry.value}"/> </td></tr>
</c:forEach>
</c:forEach>
我的 java class 正在返回类似 List>> 的值。在 JSTL 中,如何打印 LinkedHashMap 键和列表。
<c:forEach var="row" items="${myList.data}"> // Main List
<DIV>
<span option="1">${row.key}</span> // Getting empty key
</DIV>
</c:forEach>
what is .data if it is list ? I think .data will not come.Your loop should be like this
<c:forEach items="${myList}" var="map">
<c:forEach var="entry" items="${map}">
<tr><td><c:out value="${entry.key}"/></td> <td><c:out value="${entry.value}"/> </td></tr>
</c:forEach>
</c:forEach>