O'Reilly logo

Learning Spring Boot by Greg L. Turnquist

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Crafting our HTML templates

With the controller defined, we can now work on the templates. We'll go through them in the same order in which they were defined in the controller earlier.

The first template we need is one that lists all the players on the roster. Create src/main/resources/templates/teammates.html as follows:

<html xmlns:th="http://www.thymeleaf.org"> <head> <title>Learning Spring Boot - Chapter 5</title> </head> <body> <h2>All Teammates</h2> <ul> <li th:each="t : ${teammates}"> <a th:href="${t.link.href}" th:text="${t.teammate.firstName} + ' ' + ${t.teammate.lastName} + ' plays ' + ${t.teammate.position}"/> </li> </ul> <h2>Create a new teammate</h2> <form th:action="${postLink.href}" th:object="${teammate}" method="post"> <input type="text" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required