Thymeleaf - How to add checked attribute to input conditionally

后端 未结 5 559
滥情空心
滥情空心 2020-12-08 07:18

As you know, input component has an attribute, checked to whether mark the checkbox as enabled by default or not.



        
5条回答
  •  不知归路
    2020-12-08 08:03

    Neither suggested solutions worked for me.

    This one worked:

    th:checked="${#strings.equals(param.myRequestParameterXYZ, 'foobar')}"
    

提交回复
热议问题