Comparing the enum constants in thymeleaf

前端 未结 10 2058
自闭症患者
自闭症患者 2021-02-02 06:25

I have an enum, Constants:

enum Constants {
    ONE,TWO,THREE;
}

How can I compare the enum Constants in Thymeleaf.

Thank

10条回答
  •  粉色の甜心
    2021-02-02 07:06

    @Nick answer has a small syntax error, it's missing a final brace. It should be

    th:if="${day == T(my.package.MyEnum).MONDAY}"
    

提交回复
热议问题