Spring MVC request and response flow explanation

  1. Request will be received by DispatcherServlet.
  2. DispatcherServlet will take the help of HandlerMapping and get to know the @Controller class name associated with the given request.
  3. So request transfer to the @Controller, and then @Controller will process the request by executing appropriate methods and returns ModelAndView object (contains Model data and View name) back to the DispatcherServlet
  4. Now DispatcherServlet send the model object to the ViewResolver to get the actual view page.
  5. Finally, DispatcherServlet will pass the Model object to the View page to display the result.

Spring Flow First Request from JSP/HTML will hit the dispacher servlet, Based on the xml file it will go to particular controller, After going to controller it search for request mapping , based on request mapping it will go to the particular method and follows instructions and takes the model and view and give it to view resolver via dispacher servlet and view resolver will display the view.