Thymeleaf attributes
Let's look at some of the basic attributes that Thymeleaf provides for designing a page. We shall also look at the how it interacts with Java object and loops. Thymeleaf uses a lot of attributes.
- To display a message:
<p th:text="#{msg.greet}">Helloo Good Morning!</p>
- To display a loop, we have
th:each
:<li th:each="product : ${products}" th:text="${product.title}">XYZLLDD</li>
- Now, lets look at a form submit action:
<form th:action="@{/buyBook}">
- If we have to button submit, then add:
<input type="button" th:value="#{form.submit}" />