如何在 Thymeleaf 中循环遍历地图 [英] How to loop through Map in Thymeleaf

查看:34
本文介绍了如何在 Thymeleaf 中循环遍历地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解如何在 Thymeleaf 中遍历地图中的所有条目.我有一个包含 Map 的 Thymeleaf 正在处理的域对象.

I am trying to understand how to loop through all entries in a Map in Thymeleaf. I have a domain object being processed by Thymeleaf that contains a Map.

如何遍历键并获取值?

谢谢.

推荐答案

没关系...我找到了...

Nevermind... I found it...

<tr th:each="instance : ${analysis.instanceMap}">
    <td th:text="${instance.key}">keyvalue</td>
    <td th:text="${instance.value.numOfData}">num</td>
</tr>

谢谢.

这篇关于如何在 Thymeleaf 中循环遍历地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆