
Explore Thymeleaf with Spring Boot to build Spring Boot MVC web applications, learn Thymeleaf templates, expressions, loops, forms, and CRUD operations, and create a student management system with MySQL.
Explore Thymeleaf, a modern server-side Java template engine that processes HTML, XML, text, JavaScript, CSS, and plain text to power the view layer in Spring Boot MVC web applications.
Explore how the Thymeleaf engine parses templates, evaluates template expressions and attributes, and generates dynamic HTML from a Spring MVC model and controller, including th:each iteration over students.
Explore Spring MVC as a core web framework that enables web applications and RESTful services for a blog web application through a model-view-controller architecture, powered by the DispatcherServlet.
DispatcherServlet acts as the front controller and single entry point in a Spring MVC app, routing requests to the correct controllers and letting Spring Boot auto configuration register it automatically.
Explore Spring MVC core components, including the DispatcherServlet as front controller, controllers with handler methods, and the ViewResolver that maps to Thymeleaf views using a model.
Explore how Spring MVC processes an HTTP request from the dispatcher servlet through handler mapping and controllers to model creation, view resolution, and final HTML output.
Explore the three-layer Spring Boot MVC architecture, with controller, service, and repository layers, using Spring MVC for controllers, service for business logic, and Spring Data JPA with Thymeleaf and MySQL.
Create and set up a Spring Boot project using the Spring Initializer, and import it into IntelliJ IDEA. Integrate Thymeleaf with the Spring Boot Starter Thymeleaf dependency for streamlined configuration.
Add the Spring Boot starter Thymeleaf dependency to enable auto configuration, which provides the Thymeleaf view resolver and default templates location under src/main/resources/templates.
Create a Thymeleaf hello world example by building a Spring MVC controller, adding a model attribute named message with Hello World!, and rendering it in a hello-world template with th:text.
Learn how the th:text Thymeleaf attribute evaluates variable, selection, and message expressions and replaces the host tag body with the result, with a fallback to dummy data when evaluation fails.
Explore how Thymeleaf variable expressions bind model data to HTML using the ${} syntax. See practical examples with a User model to display name, email, role, and gender in templates.
Learn how to use thymeleaf selection expressions to access a previously selected object's name, email, role, and gender with the *{} syntax after th:object.
Explore Thymeleaf message expressions to externalise text into a properties file, define keys like app.name and welcome.message, and access them in templates with th:text and message expressions.
Master Thymeleaf link expressions to construct urls in templates using @{} syntax, pass parameters like id, and link to external CSS with th:href in Spring Boot 3.
Explore how Thymeleaf fragment expressions represent and reuse markup fragments across templates. Learn to create header and footer fragments and include them with th:replace and th:insert in a template.
Explains using th:each to iterate over lists, sets, maps, and arrays in Thymeleaf, with a status variable offering index, count, size, first, and last, plus a users table example.
Learn to use Thymeleaf's th:each with a status variable to track iteration, accessing count, index, size, even/odd, and first/last in Spring Boot 3 templates.
Explore Thymeleaf th:if and th:unless for conditional rendering in Spring Boot, including th:each over users and admin vs non-admin link display examples.
Explore how to implement switch-case logic in Thymeleaf using th:switch and th:case to conditionally render content based on user roles, including a default case.
Explore thymeleaf form handling with th:action, th:object, and th:field, binding form data to a UserForm model and mapping inputs to name, email, password, gender, address, married, and profession.
Demonstrates Thymeleaf binding with th:action, th:object, th:field attributes. Implements a Spring MVC handler to serve a register page, bind to UserForm model, provide professions list, and return the register-form view.
design user registration form in Thymeleaf, binding to a UserForm model with th:object and th:field, using professions list to populate a select, with name, email, password, gender radio, and address.
Create a post handler for /register/save to process the form. Use @ModelAttribute to obtain UserForm and display its name, email, password, gender, address, married, and profession on the register-success view.
Create a spring boot project in IntelliJ via spring initializer, using Maven, Java 25, and Thymeleaf with Spring Data JPA and MySQL; import and configure Lombok, and enable annotation processing.
Add the Spring Boot starter Thymeleaf dependency to auto configure Thymeleaf, its view resolver, and default templates in resources/templates, with layout and security dialect support.
Explore how the Spring Boot starter Thymeleaf dependency aggregates the required dependencies and auto-configuration to integrate Thymeleaf with Spring Boot, and configures templates in src/main/resources/templates.
Configure a MySQL database in a Spring Boot project by setting application.properties with spring.datasource properties, Hibernate dialect, and ddl-auto update; Spring Boot auto-configures a Hikari data source.
Create a student JPA entity in a Spring Boot app with Lombok getters and setters, annotate with @Entity, @Table, @Id, @GeneratedValue, and @Column for id, first_name, last_name, and email.
Create and configure a Spring Data JPA student repository by extending JpaRepository with the Student entity and Long id, leveraging SimpleJpaRepository for default CRUD and transactional behavior.
Create a student dto and a student mapper to transform between the student entity and the dto, enabling clean data transfer between controller and view in a spring boot app.
Develop the list students feature backend in Spring Boot with Thymeleaf by building a student controller and service, injecting the repository, mapping to student DTO, and returning the students view.
Develop the frontend for the list students feature by rendering the model's students in a bootstrap-styled thymeleaf template.
Add a new student link in the header and implement a get /students/new handler that creates a student model object, adds it to the model, and returns the create_student view.
Design a Thymeleaf create student form with Bootstrap, posting to /students and binding to a student model with first name, last name, and email.
Create a student feature by implementing a post handler at /students that saves form data as a student entity and redirects to the list of students.
Enable create student form validation in Spring Boot 3 using Jakarta Validation for not empty and email checks, and display errors under inputs with BindingResult.
Implement the update student backend by adding an edit button in the actions column and a handler for edit requests, plus a get-by-id service method and wiring the edit view.
Build the update student frontend by creating an edit student XHTML template, populating the form with existing data, and wiring the post action to include the student id.
Implement a delete button in the actions column to remove a student by id, wire it through the student controller and service, and redirect to the list students page.
Add a view button in the actions column and implement a get /students/{studentId}/view handler that fetches the student by id, stores it in the model, and returns the view_student view.
Introduces the view student feature on the frontend, with a view button and Thymeleaf rendering of first name, last name, and email in a Bootstrap card.
In this course, you will learn Thymeleaf fundamentals and build Spring boot MVC web applications using the latest version of Spring boot and Thymeleaf.
In this course, we will be using Spring Boot 4, Spring Framework 7, and Thymeleaf 3 - The latest versions.
What you will learn:
Learn Thymeleaf Fundamentals
Learn Thymeleaf Standard Expressions
Learn Iteration or Looping in Thymeleaf
Learn Conditionals in Thymeleaf
Form Handling in Thymeleaf
Learn Spring MVC Concepts
Learn to Create Spring Boot Project and Integrate Thymeleaf
Spring Boot Auto Configuration for Thymeleaf
Learn to Build Student Management System Project using Spring Boot and Thymeleaf
Learn to Validate Forms in Thymeleaf Templates
Learn How to Use Bootstrap CSS 5 Framework for Styling Web Pages.
What is Thymeleaf?
Thymeleaf is a modern server-side Java template engine for both web and standalone environments, capable of processing HTML, XML, JavaScript, CSS, and even plain text.
The main goal of Thymeleaf is to provide an elegant and highly-maintainable way of creating templates.
It's commonly used to generate HTML views for web applications.
Thymeleaf is a very popular choice for building UI so we will be using Thymeleaf to build the view layer in the Spring MVC web application (Student Management System).
What is Spring Boot?
Spring Boot is basically an extension of the Spring framework which eliminated the boilerplate configurations required for setting up a Spring application.
Spring Boot is an opinionated framework that helps developers build Spring-based applications quickly and easily. The main goal of Spring Boot is to quickly create Spring-based applications without requiring developers to write the same boilerplate configuration again and again.
Technologies and Tools Used:
- Java 25
- Spring Boot 4
- Spring Framework 7
- Spring MVC 7
- Thymeleaf 3+
- Bootstrap CSS 5 Framework
- Spring Data JPA
- Hibernate Framework 7
- MySQL Database
- Maven
- IntelliJ IDEA