如何在百里香叶视图 html 文件中放置多个 table 值?
How to place the multiple table values in thyme-leaf view html file?
我可以从数据库中的多个 table 中检索值,但是在百里香叶 html 标签中,我不知道如何将检索到的值放在视图页面中。谁能给我一个使用 html 和百里香叶标签显示 2 table 值的示例代码?
(spring mvc, 休眠, MySQL, 百里香叶)
这是将值从控制器传递到模板的示例方法:
public String index(Model model, HttpSession session, HttpServletResponse response, HttpServletRequest req) {
model.addAttribute("cars", this.cars);
return "index";
}
这是一个可能的片段,用于访问例如汽车列表:
<th:block th:each="car: ${cars}">
<span th:text="${car.name}"/>
</th:block>
我可以从数据库中的多个 table 中检索值,但是在百里香叶 html 标签中,我不知道如何将检索到的值放在视图页面中。谁能给我一个使用 html 和百里香叶标签显示 2 table 值的示例代码?
(spring mvc, 休眠, MySQL, 百里香叶)
这是将值从控制器传递到模板的示例方法:
public String index(Model model, HttpSession session, HttpServletResponse response, HttpServletRequest req) {
model.addAttribute("cars", this.cars);
return "index";
}
这是一个可能的片段,用于访问例如汽车列表:
<th:block th:each="car: ${cars}">
<span th:text="${car.name}"/>
</th:block>