SPRING CONCEPTS

MVC Model

Spring Concepts / MVC Model

An MVC Model contains the data passed to a view.

Understand the idea

The controller adds named attributes; the template reads those names. The model may include a list of documents, a form DTO, or an action URL. It is a presentation-data container rather than a database connection.

A concrete example

model.addAttribute("todos", service.list());

// In the template:
th:each="todo : ${todos}"

In the application

The MVC manual uses todos, todoForm, and action as model attribute names.

The attribute names in the controller and template must match exactly.

Detailed walkthrough: Trace a Spring MVC request →

See it in a working stage

Related concepts

Read the official documentation ↗
Java 21 · Spring Boot 4.1.1 · Edupoly