对于html中的href属性,src属性等地址属性,thymeleaf都有相应的替代属性,例如:
他们都是再原有的基础上加上th约束,很简单
<a th:href="@{http://www.baidu.com}">百度连接</a>
在thymeleaf中URL也是三种形式
绝对路径:
<a th:href="@{https://www.itlike.com/}">
工程路径
<a th:href="@{/hello}">跳转</a>
服务器路径
<a th:href="@{~/hello}">跳转</a>
路径中携带参数
<a th:href="@{/hero/detail(id=3,action='show_all')}">aa</a>