Spring MVC framework Introduction

This section provide you the brief introduction of Spring MVC framework and it's lifecycle.

Spring MVC framework Introduction

Spring MVC framework Introduction

This section provide you the brief introduction of Spring MVC framework and it's lifecycle.

Spring MVC is model-view-controller(MVC) based web framework. Spring MVC is the web component of the Spring framework. Spring MVC framework is highly configurable in terms of functionality and logic. Spring MVC framework integration with other framework like Struts, JSF, Tapestry etc is very easy. For rendering view JSP and Servlet is not the only option in Spring MVC framework, you can use other view technologies like Freemarker, Velocity, Excel or Pdf for providing view to the clients.

Spring MVC framework is request driven and designed around a central Servlet. This central Servlet sends requests, for processing, to suitable controller and it also render the render the view to the client with the help of  View Resolver object. The central Servlet in Spring MVC is DispatcherServlet which is fully integrated with Loc container, which give us freedom to use other features of Spring.

Given below the complete life cycle of Spring MVC (step by step):

Spring_mvc

  • First client made a request  in form of http request.

  • This request is caught by the Front controller (i.e. DispatcherServlet).

  • DispatcherServlet consults with suitable Handler Mapping to dispatch the request to suitable Controller.

  • Controller process the request, and returns model and view to the Front controller (i.e. DispatcherServlet).

  • The Front controller afterwards resolves the View with the help of View Resolver object and rendered  back to the client.