Home | | Web Technology | MVC (Model -View - Controller)

Chapter: Web Technology : Representing Web Data

MVC (Model -View - Controller)

Many web applications are based on the Model-View-Controller (MVC) architecture pattern. That is, web apps contains three parts: 1) business logic 2) presentation and 3) request processing

MVC (Model -View - Controller):

 

Many web applications are based on the Model-View-Controller (MVC) architecture pattern. That is, web apps contains three parts: 1) business logic 2) presentation and 3) request processing

 

The key motivation behind the MVC approach is the desire to separate the code that creates and manipulates the data (i.e business logic) from the code that presents the data (i.e presentation)

 

and the code that process the request (i.e controller)

 

Business logic means the code applied for manipulation of application data and presentation refers the code written for look and feel of the web page such as background color, font style, placing of form controls and so on. Controller means that process the request message.


 

According to MVC, the Model corresponds to business logic, the View corresponds to presentation and the Controller corresponds to request processing

 

Typical JSP implementation of MVC


 

Java servlet program is the Controller component that receives the request from the browser.

 

Java bean class is the Model component that processes the business logic which can use the data source for that.

 

Jsp is the View component that presents the result of the business logic to the browser with the help of controller. The following program also illustrates that.


 

In this architecture, JSP is used for creating the view for the application. A centralized Servlet is used to handle the entire request for the application. The Servlet works as the controller for the application. It then uses the Java beans for processing the business logic and getting the data

 

(Model) from the database. Finally it uses the JSP to render the view which is displayed to the user.

 

Advantage of using MVC

 

- MVC allows the developer to keep the separation between business logic, presentation and request processing. Due to this separation, any changes to the presentation can be made easy without disturbing business logic



Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Web Technology : Representing Web Data : MVC (Model -View - Controller) |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.