Introduction To Spring MVC and Its Workflow Diagram

Posted By : Abhineet Kumar Singh | 03-Mar-2022

Introduction To Spring MVC and Its Workflow Diagram

Spring MVC is a part of Spring framework that is used to develop web applications. It is built on an Model-View-Controller (MVC) pattern.

  • *Model -> Data (In case of java - PrimitiveType, Object TYpe, Collection Type)

  • a*View -> UI(User Interface) - Visible to end user

  • *Controller-> It will read request from browser/client, It will process the request and gives response using view Component

How Does Spring MVC Work?

  • *Goto Browser and Enter URL in address bar.

  • *If we enter a URL( i.e submit HTML Form/Click on HyperLInk) that makes a request (URL).

  • *Every Request given to FrontController(FC). Here FC is a pre-defined servlet name as Dispatcher Servlet given by spring. This we need to configure (web.xml for XML configuration/ AppInit for Java/Annotation configuration).But this is not required in Spring Boot because of AutoConfiguration.

  • *Whenever any requests are received at FrontController, then those details are given to HandlerMapping (which behaves like a register of controller classes). It takes the URL/Request data and provides a controller class and method name to be executed.

  • *Now FrontController will call the controller method ( details are given by HandlerMapping and objects are given by Spring Controller) for every request one time method is called.

  • *Controller class will process the request.

  • *After processing the request(Controller class), it provides the data as Model(memory that holds data in Key=Val format), model is optional.

  • *It returns ViewName(a UI page name without any folder location and file extension). examples like, HOMEPAGE(no location, no extension).

  • *FrontController reads the view name from the Controller class, it has to find out on the UI page now.

  • *FrontController calls ViewREsolver that adds prefix(file location) and suffix(file extension) and it provides FileName(UI page name) finally.Example, prefix = /pages/ and suffix = .jsp

  • *FrontController gets User Interface page Name from ViewResolver and the same page executed/called.

  • *User Interface page may read data(if it exists) from a model using EL(expression language), such a process is data rendering.

  • *Finally the User Interface Page is returned back to FrontController.

  • *FC will send the same as Response back to the browser.

  • *Browser will display data/User Interface page.

The below diagram will make it clear.


We, at Oodles, provide complete enterprise solutions with a focus on solving complex business problems using next-gen technologies. Our end-to-end ERP software development services enable enterprises to boost their productivity levels and achieve higher operational efficiency. 


Please remove URL from text

Comment is required

Sending message..
Connect with us