Spring MVC Architecture
Learn about the Spring MVC architecture and how it differs from the Servlets and JSP model.
We'll cover the following...
Spring MVC is a web framework built on top of the Spring Framework, providing a robust architecture for developing web applications. It follows the Model-View-Controller (MVC) architectural pattern, which separates an application into three interconnected components: Model, View, and Controller. Spring MVC uses the features of the core Spring framework like Inversion of Control (IoC) and dependency injection.
Components of Spring MVC
DispatcherServlet: Acts as the front controller for Spring MVC applications. It receives incoming requests and dispatches them to the appropriate controllers for processing.
Controller: Represents the C (Controller) in the MVC pattern. Controllers handle user requests, process input, and interact with the model to prepare data for the view.
Handler mapping: Maps incoming requests to appropriate controller methods based on configured URL patterns.
View resolver: Resolves logical view names returned by controllers to actual view implementations (e.g., JSP, Thymeleaf templates).
Model: Represents the M (Model) in the MVC pattern. It encapsulates the application's business logic and data. Controllers use models to pass data to views for rendering. ...