Thymeleaf - boolean operators

前端 未结 2 1713
一个人的身影
一个人的身影 2021-01-17 12:30

How can I use boolean operators like and or or using Thymeleaf?

For instance, if I want to show the data from a table if only one of the co

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-17 13:22

    Boolean operators work just like that. You use 'or', 'and' instead of the normal java nomenclature. You can also shorten your ifs.

    You can try this:

    
    

    You need to nest them up in the same curly brackets, independently if they are isolated considering the logical 'or' operation being tested.

    Be wary though! This will only show you the tr and it's child elements if the if passes as true.

提交回复
热议问题