February 2019
Intermediate to advanced
442 pages
11h 46m
English
We will be using the Thymeleaf template engine for handling server-side templates. Thymeleaf provides various dialects and conditional blocks for rendering the dynamic content within the static HTML. Let's look at some simple syntactical element of Thymeleaf, as follows:
<!-- Dynamic content in HTML tag --><div class="alert alert-info">[[${country.name}]]</div><!-- Dynamic attributes --><span th:class="|alert ${error ? 'alert-danger': _}|">[[${errorMsg}]]</span><!-- Looping --><ol> <li th:each="c : ${countries}"> [[${c.name}]] </li></ol><!-- Conditionals --><div class="alert alert-warning" th:if="${count == 0}">No results found</div><!-- Custom attributes --><div th:attr="data-count=${count}"></div><!-- Form element ...