lishman levelup
«previous  next»


Getting Started

Form Processing
IoC Container
Hibernate ORM



Getting Started with Spring Web MVC


Spring's web framework is based on the Model-View-Controller (MVC) architectural pattern.
  • The model represents the application data.
  • The view presents the data from the model.
  • The controller receives user input and populates the model.
This architecture decouples business functionality from the presentation logic.

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.

Info This tutorial focuses on annotation-driven configuration, which was introduced in Spring 2.5.
The model consists of JavaBean components which are produced by the controller, ready for the view.

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.
»