【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
后端代码:
List<String> ls=starService.getAllFamousNames();
mav.addObject("famousNames", ls);
前端代码:
<ol> <li th:each="name:${famousNames}"> <span th:text="${name}"></span> </li> </ol>
显示效果:
END