Skip to content
Advertisement

Spring MVC request and response flow explanation

I can’t find correct client request flow in below syntax.Could someone please clarify what is happening here?

Client(1) --> Dispatcher Servlet(2) --> Handler Mapping(3) --> Controller(4) -->
ModelAndView(5) --> viewResolver(6) --> View(7) --> Client(1) 

If possible please specify what are the corresponding spring classes/interfaces used in spring MVC process.

Advertisement

Answer

  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.
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement