0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Thymeleaf if文書く時よく間違うのでメモ

Last updated at Posted at 2021-05-23

Thymeleafでif文を書くときによく間違うので書いておく。
以下記事に記載があるように、ちゃんと指定された演算子を使わないと動かない。
また ==は動いたりするのでついついjavaの演算子とかでいけると勘違いしてしまう。
https://qiita.com/narikei/items/c4780d6bb69902380136

例えばjavaで書いた場合の
if (testFlg == 1 && (testId == 0 || testId == 1)) はThymeleafで以下のように書く

<div th:if="${testFlg eq 0 and (testId eq 0 or testId eq 1)}">
    <li>メモ</li>
</div>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?