Getting Started with Spring Web MVC
Spring's web framework is based on the
(MVC) architectural pattern.
This architecture decouples business functionality from the presentation logic.
- The model represents the application data.
- The view presents the data from the model.
- The controller receives user input and populates the model.
The Spring MVC Implementation
In Spring Web MVC, the controller is a Java class which receives web requests
from the user, performs some business logic (usually on the service layer),
and returns domain objects into the model.
The model consists of JavaBean components which are produced by the controller,
ready for the view.
This tutorial focuses on annotation-driven configuration, which
was introduced in Spring 2.5.
Although Spring MVC is view-agnostic (it can be used with Velocity templates or XSLT etc),
views are usually developed using JavaServer Pages (JSP) with the Java Standard Tag Library (JSTL).
The Java objects in the model can be accessed using the JSP expression language.
Let's develop a simple application to demonstrate how easily a website can be
created using Spring Web MVC.