th:value sets a rendered HTML element’s value from a Thymeleaf expression. In a taco design form, it assigns each ingredient checkbox the ingredient’s id. section 2.1.3
Ingredient checkbox
Use th:value="${ingredient.id}" inside a th:each loop. Each rendered checkbox then carries the current ingredient’s identifier, while th:field binds the checkbox group to the form object. section 2.1.3
<h3>Designate your wrap:</h3>
<div th:each="ingredient : ${wrap}">
<input th:field="*{ingredients}" type="checkbox"
th:value="${ingredient.id}"/>
<span th:text="${ingredient.name}">INGREDIENT</span><br/>
</div>
A complete snippet combines th:each, th:field, and th:value to render selectable wrap ingredients from model data. section 2.1.3
