Model

Learn how to pass data between controllers and views.

In a Spring MVC application, the Model manages data. It serves as a container for carrying data between different components of the application. When the Controller retrieves data from sources like databases, web services, or Spring beans, it places this data into the Model. The View template can access this data to display it to the client. The Model acts as the intermediary for transporting data between the various parts of the application.


In this lesson, we will first pass the Model to our Controller class, then add some data to it and finally show how the data in the Model is accessed in the View page.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.