【问题标题】:Thymeleaf URI template JSP equivalentThymeleaf URI 模板 JSP 等效
【发布时间】:2016-11-10 15:40:59
【问题描述】:

在 JSP 中,我曾经使用这种语法有一个表和一个到记录的链接:

<td><a href="<spring:url value="/person/${person.id}"/>">${person.id}</a></td>

所以我可以单击表格上的链接来移动到某个人的详细信息页面。我想使用 Thymeleaf 实现相同的结果,但不太确定如何。所以我的问题是:Thymeleaf 等价物是什么?

<td th:text="${trip.hrPerson}"></td>

<td><a th:href="@{/remove/trip.id}"></a>  ${trip.id}  </td>

第一个例子显示静态值,没关系,第二个应该是一个链接,但它失败了。

【问题讨论】:

  • 分享表格的html

标签: spring jsp thymeleaf


【解决方案1】:

Thymleaf 中,您制作链接如下

<a th:href="@{'/person/' + $person.id}" th:text="${person.id}">My User id</a>

【讨论】:

  • 很高兴它有帮助:)
猜你喜欢
  • 2020-03-23
  • 2018-05-13
  • 2017-05-10
  • 1970-01-01
  • 2016-01-26
  • 2011-07-15
  • 1970-01-01
  • 2020-12-06
  • 1970-01-01
相关资源
最近更新 更多