Stop using JSP to create your Web applications, this is a world where you have countless tools with pros and cons, give yourself the opportunity to know and decide whether they are worth it or not. In case you want to see Part 1 of this tutorial then I leave the link: Spring Boot + MVC Part 1 | Using JSP?
I will show you a minuscule part of the potential of Thymeleaf.
For this we start with the most basic question.
What is Thymeleaf?
It is a template engine, which feeds with HTML files, processes and generates WEB content in a natural and readable way to the human eye, because it does not add or invent tags, but sometimes if it adds attributes. Let’s see an example of what was described in the preceding paragraph, in the image on the left you will find that there is a table and a single row, where only some attributes are added. Look in the image on the right the HTML result after passing through the Thymeleaf template engine.
I think there is nothing more to say to introduce Thymeleaf, I invite you to give it a chance and enjoy it.
review my video tutorial where I show you more Characteristics of Thymeleaf and how to configure them to use with SPRING BOOT 2
GitHub: GitHub repository
To summarize, I showed you how Print a list by iterating this same with the th:each attribute in the HTML, you also learned to use the TH:Class attribute, to make association conditions and to print values on the screen.
Do not forget to share this post and leave your opinion below in the comments.
PS: Do not forget that this is not an advanced tutorial or expert about Thymeleaf. It’s just an introduction.
Thank you,
@Cruizg93
Spring Boot Introduction:
- Spring Boot – 01 – What is it? And how do you eat it?
- Spring Boot + MVC Part 1 | Using JSP?
- Spring Boot + MVC Part 2 | Using Thymeleaf (current)
- Spring Boot CRUD + MVC + JPA + H2 Part 1
- Spring Boot CRUD + MVC + JPA relations 1:1 and *:*