Writing our First Controller
Explore how to build your first controller in a Spring Boot application using Thymeleaf. Understand the MVC pattern by managing URL requests, passing data via the Model, and rendering dynamic templates to create interactive web pages.
We'll cover the following...
We'll cover the following...
MVC
Our template worked, but it’s not doing anything substantial yet. So, to render things from the application, we will use Spring MVC.
MVC is a well-known design pattern based on Model, View, and Controller.
- View: View, as the name implies, is the visual part of the design pattern. This is already defined in the
index.htmlfile. - Controller: The controller is responsible for fetching the data from the application and showing the correct view according to the requested