1.添加热部署,为了测试不用频繁重启
<!--热部署插件-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional><!-- 防止将该依赖传递到其他模块中 -->
</dependency>
变量表达式:
语法:${} 或 *{}
<td th:text="${user.nick}">x</td>
<td th:text="${user.phone}">137xxxxxxxx</td>
<td th:text="${user.email}">xxx@xx.com</td>
<td th:text="${user.address}">北京.xxx</td>
也可以
<td th:text="*{user.nick}">x</td>
<td th:text="*{user.phone}">137xxxxxxxx</td>
<td th:text="*{user.email}">xxx@xx.com</td>
<td th:text="*{user.address}">北京.xxx</td>
内联表达式[[…]]
[[${user.nick}]]
[[${user.phone}]]
[[${user.email}]]
[[${user.address}]]
URL表达式
语法:@{...}
URL表达式可用于 <script src="...">、<link href="...">、<a href="...">、<form action="...">等有URL的地方;
比如:
<a th:href="@{'http://localhost:8080/boot/user?id='+${user.id}}">查看</a>
<a th:href="@{'boot/user?id='+${user.id}}">查看</a>
<a th:href="@{'/boot/user?id='+${user.id}}">查看</a> (项目的上下文名会被自动添加)
- springboot-thymeleaf 表达式 springboot thymeleaf 24springboot-thymeleaf表达式springboot thymeleaf springboot-thymeleaf springboot-thymeleaf springboot thymeleaf对象 springboot-thymeleaf springboot thymeleaf属性 常量springboot-thymeleaf字符串springboot springboot thymeleaf 23 springboot thymeleaf spring6页面 语法springboot图标thymeleaf springboot thymeleaf管理系统mybatis springboot thymeleaf框架 国际