Java OpenResty Spring Spring Boot MySQL Redis MongoDB PostgreSQL Linux Android Nginx 面试 小程序 Arthas JVM AQS juc Kubernetes Docker 诊断工具


Spring Boot Thymeleaf 字符串拼接

Spring Boot Thymeleaf 大约 277 字

使用 + 号

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

<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}|"/>
阅读 142 · 发布于 2023-08-28

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb

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

扫描二维码关注我
昵称:
随便看看 换一批