How does request flow happen in Spring MVC?
DispatcherServlet acts as the front controller. Simplified actions taken by DispatcherServlet are listed below:
- STEP 1: All requests arrive at the DispatcherServlet (Front Controller).
- STEP 2: DispatcherServlet resolves theme and locale as configured.
- STEP 3: Find’s appropriate Controller (Handler) to handle the request. (pre-processors and post-processors, if configured)
- STEP 4: Redirect to the Controller (Handler).
- STEP 5: Controller executes the request and returns a view name and a view model object.
- STEP 6: DispatcherServlet resolves the view name and redirects to the view template. The response html is returned to DispatcherServlet.
- STEP 7: DispatcherServlet send the response back to the browser.