后端代码:

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

前端代码:

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

显示效果:

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

 END

相关文章:

  • 2021-12-06
  • 2022-01-10
  • 2021-05-20
  • 2022-12-23
  • 2021-11-19
  • 2022-02-18
猜你喜欢
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
相关资源
相似解决方案