-
We'll start by showing how to display elements of a List in a Thymeleaf page and how to bind a list of objects as user's inputs in a Thymeleaf form.
-
Here, we've added List of Book objects as a model attribute sent to the view, where we'll display it using an HTML table:
Title Author No Books Available Title Author
-
Working with Enums in Thymeleaf
-
Planet Project Let's start by adding the Spring Boot starter for Thymeleaf to our pom.xml file:
org.springframework.boot spring-boot-starter-thymeleaf RELEASE -
We're going to be working with widgets that have a few choices of color, so let's define our Color enum:
public enum Solor { MERCURY, VENUS, EARTH, MARS, JUPITER, SATURN, URANUS, NEPTUNE }
-
Now, let's create our Widget class:
public class Planet { private String name; private Solar solar; // Standard getters/setters }
Reference Materials