【问题标题】:Evaluating multiple expression using th:if in Thymeleaf在 Thymeleaf 中使用 th:if 评估多个表达式
【发布时间】:2018-03-22 13:14:20
【问题描述】:

我想知道 Thymeleaf 中 th:if 中多个表达式的正确语法是什么。 到目前为止,我有这样的事情:

<a style="color:blue" th:href="@{/approveAndJoin/{name}(name=${outbox.receiverName})}" th:if="${not #strings.startsWith(outbox.status, 'P')}">Join Team?!</a>

正确的语法是这样的: (伪代码)

th:if="${not #strings.startsWith(outbox.status, 'P') && #strings.startsWith(inbox.status, 'A'}"

我已经阅读了各种手册,但还没有发现如何做到这一点。

【问题讨论】:

    标签: if-statement thymeleaf


    【解决方案1】:

    您可以将多个条件与关键字and结合起来

    例如在你的情况下th:if="${not #strings.startsWith(outbox.status, 'P') and #strings.startsWith(inbox.status, 'A'}"

    【讨论】:

      猜你喜欢
      • 2016-12-19
      • 2018-02-20
      • 2014-07-22
      • 2015-02-22
      • 2017-04-20
      • 2014-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多