Friday, June 12, 2009

Model View Controller (MVC) Design Pattern

Model-View-Controller (MVC) is a design pattern put together to help control change. MVC decouples interface from business logic and data. The MVC (Model-View-Controller) architecture the client request is first intercepted by a servlet referred as controller servlet, this servlet handles the initial processing of the request and determines which JSP page to display next. Here the controller servlet is the single point of entry, there is a clear sepration of business logic, presentation output and request processing.

MCV architecture is a way of decomposing an application into three parts:

Model : The model contains the core of the application's functionality. The model encapsulates the state of the application. Sometimes the only functionality it contains is state. It knows nothing about the view or controller.The model maintains the state and data that the application represents.

View: The view provides the presentation of the model. It is the look of the application. The view can access the model getters, but it has no knowledge of the setters. In addition, it knows nothing about the controller. The view should be notified when changes to the model occur.The view allows the display of information about the model to the user.

Controller: The controller reacts to the user input. It creates and sets the model.The controller allows the user to manipulate the application.

MVC Design Pattern comprised of two models.
  • MVC Model 1 is a Page Centric Architechure
  • MVC Model 2 is a Serlet Centric Architechure
Struts frame work extensively makes use of MVC 2 Architecture

MVC was originally applied in the graphical user interaction model of input, processing and output. In Struts, the view is handled by JSPs and presentation components, the model is represented by Java Beans and the controller uses Servlets to perform its action.

0 comments:

Blog Widget by LinkWithin

JS-Kit Comments

  © Blogger template Newspaper III by Ourblogtemplates.com 2008

Back to TOP