thymeleaf input text code example

Example 1: thymeleaf input radio checked

<input type="checkbox" name="active" th:checked="${user.active}" />

Example 2: thymeleaf radio button

<ul>
  <li th:each="ty : ${allTypes}">
    <input type="radio" th:field="*{type}" th:value="${ty}" />
    <label th:for="${#ids.prev('type')}" th:text="#{${'seedstarter.type.' + ty}}">Wireframe</label>
  </li>
</ul>

Example 3: how to use thymeleaf in html view spring

// Add xmlns:th="http://www.thymeleaf.org" into the html opening tag like
<html lang="en" xmlns:th="http://www.thymeleaf.org">

Tags:

Java Example