Model View Controller (MVC)
- MVC architecture is an architectural design pattern to develop a dynamic web application in a standard manner.
- MVC pattern makes easy to develop JEE application.
- In this architecture there is a client ,a server and a database.
- It consists of 3 basic components such as model component,view component and controller component.
- Here the servlet and its equal component (filter) is consider as controller component.
- A set of jsp pages are considered as view component.
- A set of technologies like Javabean,Jdbc,Hibernate,EJB are considered as model component.
The MVC architecture maintains a standard flow of executions.
- The Request will come from client to the controller component ,which is mandatory.
- When the request will reach at the controller component ,then the controller component is responsible to choose a particular technology as a model component.
- Here basically consider Javabean as model.
- Javabean is nothing but a simple java class containing getter() ,setter() and also contain our business logic.
- Then the controller component creates the object of model class and execute the business logic whatever the business logic defined in the model.
- Then the controller component choose a particular JSP page as view component which provides the response to the respective client.
- Here the view component call interact with model component and vice-versa.
Rules and Regulations
- Servlet and its equal components(filter) must be the controller component set of JSP pages must be the view component set of technology(javabean,jdbc,hibernate,EJB)must be the model component .
- The request coming from client must reach at the controller component.
- The controller component must execute the business logic.
- Model component can interact with database.The controller and view component can not interact with database.If they want to interact with database then they can interact via media component.
- JSP page must be developed in such a way that it should maintain page2 controller collaboration.
- The view component must provide the response to client.