gpt4 book ai didi

if-statement - ThymeLeaf : how to do it in plain text? 中的条件文本

转载 作者:行者123 更新时间:2023-12-04 03:58:09 24 4
gpt4 key购买 nike

我了解 th:if 如何用于 html 模板,但是当您期望纯文本(用例:纯文本电子邮件模板)时,我没有找到有关如何执行此操作的任何线索。

到目前为止,我尝试过:

<html xmlns:th="http://www.thymeleaf.org" th:inline="text" th:remove="tag">
Dear [[${contact.firstname}]] [[${contact.lastname}]],
An alert was triggered at location: [[${account.address}]]
<span th:if=\"${videoLink}\">To view your security camera recordings, please click on [[${videoLink]]</span>
</html>


它有效......但结果包含标签。知道我做错了什么吗?

谢谢,
西里尔

最佳答案

Thymeleaf 2.1 有一个 th:block标签,它基本上是属性的容器。您的条件文本可以这样完成:

<th:block th:if="${videoLink}">To view your...</th:block>

关于if-statement - ThymeLeaf : how to do it in plain text? 中的条件文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30616976/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com