Introduction to MVC Design patterns

Source: Internet
Author: User

1. MVC Design Pattern

Model 1 Architecture mode (basically no use)

The core of model 1 is the JSP file, and the project developed using Model 1 contains a large number of independent JSP files and a small subset of JavaBean. When developing with model 1, the JSP is responsible for receiving form parameters, processing business logic, and ultimately returning the results to the client's browser side.

The program flow of Model 1 is relatively easy to understand. The user submits the information to the JSP page, the JSP accepts the user's submitted value and connects the database and the operation database through JavaBean, and then returns the result to the user.

Disadvantages:

(1) in the JSP is flooded with a lot of Java script code, late maintenance is very troublesome;

(2) Code reusability is very poor;

(3) Poor scalability, early development of the project if adding new features is very complex and cumbersome.

Model 2 Schema Mode

Model 2 is an object-oriented technology to implement the MVC pattern, thus extending the Jsp/servlet form of a new architectural pattern. MVC consists of 3 basic components, model, view, controller, respectively. (The View section generally uses the JSP to realize, the model part generally uses the JavaBean to realize, the controller part generally uses the servlet to realize).

Steps:

(1) The client is requesting the Controller;

(2) The controller calls the corresponding model according to the corresponding request;

(3) The controller then interacts with the model processing data to the view;

(4) View is presented to the client.

Advantages:

(1) The Division of labor is clear and the coupling decreases;

(2) Views and logic are further differentiated to facilitate maintenance.

Introduction to MVC Design patterns

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.