我想在 html 表中顯示以下行:
"$num out of $totalCount"
例如num=5,totalCount=8
我想在表格中看到5 out of 8
這是我的代碼:
...
<tr>
<td th:text="${num} out of ${totalCount}" />
</tr>
...
我在控制器中添加num和totalCount作為模型。
我收到以下錯誤:
Could not parse as expression: "${num} out of ${totalCount}"
這樣做的正確語法是什么?
uj5u.com熱心網友回復:
Thymeleaf 中有幾個字串連接選項。有關概述,請參閱字串與 Thymeleaf 的串聯。
在這種情況下,您可以使用以下內容:
<td th:text="|${num} out of ${totalCount}|" />
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/352837.html
