MVC design Pattern

Source: Internet
Author: User

MVC (Model-view-controller): the input, processing, and output processes of an application are separated by Model-view-controller, so that an application is divided into three layers.

Model: Includes the business logic layer and the database access layer.

The business logic layer is typically built by JavaBean or EJB.

EJB is the core component of Java EE and can build distributed Application system. Unlike ordinary JavaBean, it consists of two interfaces and an implementation class, and contains some inherent methods for controlling the life cycle of the container.

View: typically built from JSP and HTML.

The user submits the request in the View section, the servlet gets the request, calls the appropriate business module to process it, and returns the processing result to the view (the next jump) section is displayed.

Controller: Typically made up of servlets.

When the user requests from the View section, the controller invokes the corresponding business logic component processing, and after the request processing is completed, the controller forwards to the appropriate view component display according to the processing result.

Thus, the Controller acts as a bridge between the view layer and the business logic layer, controlling the flow of data between the two.

MVC Design Pattern Workflow:

(1) The user's request (V) is submitted to the Controller (C).

(2) The controller receives the user request, according to the specific needs of the user, call the appropriate JavaBean or EJB to process the user's request.

(3) Controller call m after processing the data, according to the processing results of the next jump, such as jump to another page or other servlet

Note: The specific example can refer to the previous code

MVC design Pattern

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.