Model reference
Reference Figure: Request Flow in MVC
A step by step view of a single request as it moves from the browser through the controller, service and data layers and back to a rendered page.
Every screen in a generated application follows the same request flow. Once the flow is familiar, a new screen is easy to trace: find the mapping, follow the service call, then read the view.
The flow in order
- Dispatch. The servlet dispatcher receives the request and looks up a handler.
- Bind. Request parameters are bound to method arguments or to a form object.
- Validate. A validator checks the bound object and records any errors.
- Call. The controller calls one service operation with the validated input.
- Render. The controller returns a view name and the view resolver renders the page.
Redirect after post
Write operations end with a redirect rather than a direct render. A redirect prevents a browser refresh from repeating the write. The generated create and edit actions follow this rule, and the flash attributes carry the success message across the redirect.
The flow figure is also useful when reviewing a pull request. Trace one request end to end and confirm that each layer has a single, clear responsibility.