thymeleaf input radio checked
To set the "checked" attribute of a radio input in Thymeleaf, you can use the "th:checked" attribute. Here's an example of how you can achieve this:
<input type="radio" th:checked="${yourCondition}" />
In the above code, you can replace ${yourCondition}
with your actual condition or expression that determines whether the radio input should be checked or not. If the condition evaluates to true
, the "checked" attribute will be set, and the radio input will be selected.
Remember to include the Thymeleaf namespace declaration at the top of your HTML file:
<html xmlns:th="http://www.thymeleaf.org">
This allows you to use Thymeleaf attributes in your HTML code.
I hope this helps! Let me know if you have any further questions.