【Thymeleaf】th:each 遍历集合示例

后端代码:

List<String> ls=starService.getAllFamousNames();
        mav.addObject("famousNames", ls);

前端代码:

<ol>
    <li th:each="name:${famousNames}">
        <span th:text="${name}"></span>
    </li>
</ol>

显示效果:

 END

原文地址:https://www.cnblogs.com/heyang78/p/15449490.html