Writing our First Controller
Learn how to create a controller from scratch.
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.html
file. - Controller: The controller is responsible for fetching the data from the application and showing the correct view according to the requested URL. The current lesson focuses on this part of the MVC.
- Model: Model is the object passed by the controller to the view with the data that will be used to render the template.
Get hands-on with 1400+ tech skills courses.