jsp - 如何在 JSTL 中循环 LinkedHashMap 列表并获取键和值
问题描述
我的 java 类返回 List>>之类的值。在 JSTL 中,如何打印 LinkedHashMap Key 和 List 。
<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>
推荐阅读
- react-native - 在 React Native 中滑动刷新以查看视图
- r - 如何聚合一列中的值以创建新列
- sql - 使用重复数据时如何创建合并 SQL
- ios - 缺少 NFCTagReaderSession 所需的权利
- android - ContextCompat.getColor() 忽略 NightMode
- python - 传输/切换/更改两列的值,如果一列是 0 / NaN
- java - 骆驼从属性文件中转义特殊字符
- java - 一种在 Java 中播放 Azure 输出格式“audio-16khz-128kbitrate-mono-mp3”的方法
- python - find_element_by_name 在 Python 中不起作用
- php - 上传流式文件内容时 Azure 存储 PHP 客户端无法进行身份验证