spring boot -thymeleaf-url

 绝对路径格式:th:href="@{http://www.baidu.com}"

<a th:href="@{http://www.baidu.com}">绝对路径1</a>
<a th:href="http://www.baidu.com">绝对路径1</a>(不加@{}是错误的写法)

相对当前项目上下文的路径格式:
th:href="@{/page}"
相对服务器的路径格式:
th:href="@{~/project/page}"

相对路径url参数传递(id=1,name1=he)
<a th:href="@{/tmp(id=1,name1=he)}">相对路径1</a> (地址栏显示 http://hcss:8090/tmp?id=1&name1=he)

参考 https://jingyan.baidu.com/article/37bce2be44479e1003f3a251.html


猜你喜欢

转载自www.cnblogs.com/hongchengshise/p/10513956.html