Controller - First part
The Controller is the most important component because it handles all incoming requests.
DispatcherServlet(Front controller) --> HandlerMapping(URLs& ref control)--> Actual controller.
When the user sends a request, it first reaches the Controller.
The Controller layer typically includes:
1.Front Controller (e.g., DispatcherServlet in Spring)
2.URL Mapping (decides which controller method should handle the request)
3.Actual Controller Logic (processes the request and returns a response)
Model - Second part
This level is considered the lowest level when compared with the View and Controller. It primarily represents the data to the user and defines the storage of all the application’s data objects.
User --> Dispatche servlet(front controller)--> Controller-->Module-->Services, repositories, Database- data
View - Third part
The View component is used for all the UI logic of the application. It generates a user interface for the user. Views are created by the data which is collected by the model component but these data aren’t taken directly but through the controller. It only interacts with the controller.
Responsibilities:
Rendering data to the user in a specific format.
Displaying the user interface elements.
Updating the display when the Model changes.
Example: In a bookstore application, the View would display the list of books, book details, and provide input fields for searching or filtering books.
Dispatcher servlet --> Controller --> Model --> View --> Front end design(UI)
Top comments (0)