I would like to write a conditional expression using the thymeleaf trinomial operator.
1, In the case of prod.Num=='12'
, indicate 'preparing'.
2, If prod.Num=='13'&prod.sis=='spring'
, I would like to say 'output' but
Please let me know how to write the conditional expression.
<div th:text="${prod.Num=='12'? 'Preparing':${prod.Num=='13'&prod.sis=='spring'}? 'Output':'123'}">/div>
It may be wrong because I haven't checked the operation, but I think this is probably the case.
<div th:text="${prod.Num=='12'}? 'Preparing':${prod.Num=='13'&prod.sis=='spring'}? 'Output':'123'">>/div>
However, nested trinomial operators are not recommended because they are less readable.
editing:
You need and
instead of &
, and then ()
.
<div th:text="${prod.Num=='12'}? 'Preparing': (${prod.Num=='13' and prod.sis=='spring'}? 'Output':'123')">/div>
© 2024 OneMinuteCode. All rights reserved.