如何显示列表<;地图<;字符串,对象>&燃气轮机;在HTML5中使用thymeleaf
我的应用程序使用HTML5+Thymeleaf 我从数据库中提取了几行,显示为搜索结果 PersonDAO.java如何显示列表<;地图<;字符串,对象>&燃气轮机;在HTML5中使用thymeleaf,html,list,dictionary,thymeleaf,Html,List,Dictionary,Thymeleaf,我的应用程序使用HTML5+Thymeleaf 我从数据库中提取了几行,显示为搜索结果 PersonDAO.java String sql = "SELECT P.PERSON_ID, P.PERSON_NAME, C.COMPANY_ID FROM PERSON P LEFT JOIN COMPANY C ON P.PERSON_ID = C.PERSON_ID WHERE P.PERSON_ID='1001'"; List<Map<String, Object>> l
String sql = "SELECT P.PERSON_ID, P.PERSON_NAME, C.COMPANY_ID FROM PERSON P LEFT JOIN COMPANY C ON P.PERSON_ID = C.PERSON_ID WHERE P.PERSON_ID='1001'";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql );
我需要在下表中显示上述值:
(应为HTML格式的表格)
对于列表,我可以这样做:
<div id="resultstab" th:if="!${#lists.isEmpty(searchList)}">
<tbody>
<tr th:each="person : ${searchList}">
<td class="tg bg" th:text="${person.person_id}"></td>
</tr>
</tbody>
</div>
但是,我不知道如何显示列表
。
有人能帮忙吗。
谢谢简言之 迭代映射时,iter变量将为java.util.Map.Entry类
详细信息
<tbody>
<tr th:each="person : ${searchList}">
<td th:each="entry : ${person}"
th:text="${entry.value}"></td>
</tr>
</tbody>
<div id="resultstab" th:if="!${#lists.isEmpty(searchList)}">
<tbody>
<tr th:each="person : ${searchList}">
<td class="tg bg" th:text="${person.person_id}"></td>
</tr>
</tbody>
</div>
<tbody>
<tr th:each="person : ${searchList}">
<td th:each="entry : ${person}"
th:text="${entry.value}"></td>
</tr>
</tbody>