As we are moving ahead with learning Spring, it’s important that we first understand the application flow of a Spring MVC based web application, which we have beautifully depicted in the below flow diagram.
- Handler mapping maps all the request mappings in the controllers. This happens at server startup.
- Based on the request that gets hit, dispatcher servlet asks the handler mapping as to which equivalent controller method needs to be invoked.
- The controller after completing it’s task finally returns a view, model and view or a simple string to the dispatcher servlet.
- The dispatcher servlet then checks with the view resolver and finally resolves the view returned in step 3, integrates the model to the view and renders it on the browser.
Now Thymeleaf and JSP enters at the view level.