Spring Boot Thymeleaf 字符串拼接

Spring Boot Thymeleaf About 277 words

使用 + 号

将常量字符串使用单引号''括起来,变量使用${}表示,使用+号联结。

<a th:href="'/p/' + ${post.id} + '.html'">标题</a>

<th:block th:text="'阅读量: ' + ${post.pv}"/>

使用 || 号

使用||将常量与变量些在一起。

<a th:href="|/p/${post.id}.html|">标题</a>

<th:block th:text="|阅读量: ${post.pv}|"/>
Views: 288 · Posted: 2023-08-28

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh