how to bind thymeleaf checkbox value to boolean variable in spring ?
posted 2 years ago
I am trying to bind checkbox value to spring bean as boolean. when use check the checkbox then it will take as true value otherwise false.
This is what I have done so far. I am using `Kotlin` as programming language and `Thymeleaf` with the html page.
this is the bean,
this is the rest controller
the request is hit the controller successfully but how can I bind the value true when the checkbox is check and false otherwise.
Thanks in advance.
posted 1 year ago
One other option is to utilize two different radio buttons and use the th:field="isPresent" option to specify that return attribute is named "isPresent".
I'm not sure if your stuff is working, but I don't see that you've assigned an object to your form. You can include th:object="AttendanceJson" in your 'form' HTML element.