thymeleaf模板 th:href 踩坑

使用 <a th:href="@{/product/add}" target="_blank">产品</a>

可以得到 <a th:href="/product/add" target="_blank">产品</a>

使用 <a th:href="@{/product/show(skuid=${product.id})}" target="_blank">产品</a>

可以得到 <a th:href="/product/show?skuid=12" target="_blank">产品</a>

使用 <a th:href="@{'/product/show/'+${product.id}}" target="_blank">产品</a>

可以得到 <a th:href="/product/show/12" target="_blank">产品</a>

原文地址:https://www.cnblogs.com/moncat/p/7366541.html