2016-11-10 40 views
0

在JSP中我曾經有一個表,使用此語法,達到創紀錄的鏈接:Thymeleaf URI模板JSP相當於

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

這樣我就可以點擊桌子上的鏈接移動到一個人的詳細信息頁面。我想用Thymeleaf達到同樣的效果,但不太清楚如何。所以我的問題是:什麼是Thymeleaf等同? enter image description here

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

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

第一個示例顯示靜態值,它的確定,二是應該是一個鏈接,但它失敗。

+0

分享的HTML表 –

回答

1

Thymleaf你做鏈接如下

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

你能提供解決我的情況的一個例子? – jarosik

+0

請嘗試更新回答 –

+0

此解決方案的工作原理,感謝您的幫助! – jarosik