Intro to Spring Boot: Views (Part 2)

Notes

Keep building functionality into your CheeseMVC application by coding along with the video. We'll cover some new Thymeleaf syntax including the following:

For Loops

Example of creating an unordered list from model data:

<ul>
    <li th:each="cheese : ${cheeses}" th:text="${cheese}"></li>
</ul>

Conditions

Example of conditionally displaying a message if there is no model data for cheeses or the size of the ArrayList is zero:

<p th:unless="${cheeses} and ${cheeses.size()}">no cheese :(</p>

Code

We start this lesson with the code in the video-views-pt2-start branch of the cheese-mvc repo: starting code.

We end this lesson with the code in the video-views-pt2-end branch of the cheese-mvc repo: ending code.