SPRINGBOOT基础05

Springboot基础 Day05

static文件夹与templates文件夹的区别

templates 里的资源需要tymleaf帮忙解析才能访问
static 里的存放的是静态资源可以直接访问

利用 tymeleaf 在html中显示出数据

  1. @{路径/{变量名(变量名=${域名.方法名})
  2. th:each 展示一组数据

这是遍历的代码,可以参考

<tr th:each="g:${goods}">
    <td th:text="${g.id}">1</td>
    <td th:text="${g.name}">AAA</td>
    <td th:text="${g.remark}">AAA</td>
    <td th:text="${#dates.format(g.createdTime, 'yyyy/MM/dd HH:mm')}">2020/08/31</td>
    <td><a href="#" th:href="@{/goods/doDeleteById/{id}(id=${g.id})}">delete</a></td>
    <td><a href="#" th:href="@{/goods/doFindById/{id}(id=${g.id})}">update</a></td>
</tr>

评论

暂无评论