The Spring MVC flow looks like this:
- The client sends an HTTP request to the web server.
- The dispatcher servlet uses the handler mapping to find out which controller action to call.
- The dispatcher servlet calls the controller’s action.
- After executing the action, the controller returns the view name the dispatcher servlet needs to render into the HTTP response.
- The response is sent back to the client.
Step 4 is where things get interesting — we want the controller to return not just the view name, but also send data to the view. The view incorporates this data to build the actual HTTP response.