MVC Model Overview (1)

Source: Internet
Author: User

excerpt from (private school online, with Tao Xue Springmvc)1. Overview of the standard MVC model

the MVC model (model-view-controller) is an architectural pattern that does not introduce new functionality by itself. Just help us to make the structure of the development more reasonable, so that the presentation and model separation, Process Control logic, business logic calls and display logic separation.

Model provides the data to be displayed. View is responsible for the presentation of the model, generally we see the user interface, what the customer wants to see. The controller receives the user request, delegates to the model for processing (state changes), returns the returned model data to the view after processing, and is displayed by the view.

In standard MVC, the model can proactively push the data to update the view (The Observer design pattern, register the view on the model, and automatically update the view when the model is updated).

2.Web MVC Model Overview

In Web MVC mode, the model cannot proactively push data to the view (the user interface cannot be actively updated), and if the user wants the view to be updated, it needs to send another request (that is, the request-response model).

The first step: the Web browser uses HTTP requests to communicate the user's actions to the server. (When the HTTP request arrives at the server, the MVC pattern begins to run.) The Web application begins to work based on the information carried in the request, such as the URL and any parameters. )

Step two: The server finishes some processing and generates a view. (When it finishes processing a user request, it may create or update a model that transfers responsibility to the view.) )

Step three: Use the HTTP response to transfer the view back to the client. (The view uses HTTP responses to transfer data back to the client, such as pages that use HTML markup, or raw data from an Excel document.) )

the request-response model in web development . The Web client initiates the request and the Web server receives, processes, and generates a response. The general Web server is unable to proactively notify the Web client of the update content.

    1. A Web browser (such as IE) initiates a request, such as accessing http://www.kjnyjt.com.
    2. The Web server (such as Tomcat/jetty) receives the request, processes the request, and finally produces a response (typically HTML).
    3. After the Web server finishes processing, the content is returned to the Web client (Web browser), and the client processes the received content (such as the Web browser will interface to the received HTML content with CSS-style rendering to present to the customer).

3. Mainstream WEB MVC framework

A good web framework distinguishes request sending from processing, using the front-end controller servlet (Front controller servlet) to send HTTP request behavior. In other words, the dispatcher (dispatcher) determines which controller is required to complete each request, and the controller finishes the actual processing. The mainstream web MVC framework is:

    1. Struts1
    2. Struts2
    3. WebWork
    4. Jsf
    5. Spring MVC

Spring, too, is the main entrance to any request that a user publishes is Dispatcherservlet. The dispatcher servlet must be declared in the Web. xml file.

4.Web-side development history

Cgi-->servlet-->jsp-->model1

Cgi-->servlet-->jsp-->model2 (WEBMVC)-->front Controller + Page Controller

    1. Servlet A Java EE Web Component technology, a Web component that executes on the server side, is used to receive Web user requests and processes, and finally dynamically generates responses to the user. The essence is to output the HTML stream inside the Java code. The biggest problem is outputting HTML directly in the Java code.
    2. The JSP(Java Server page) is a Web component that executes on the server side and is a template page technology that runs in a standard HTML page embedded in the scripting language (now Java only). The essence is to embed Java code in the HTML code. The SP is still a servlet and will eventually be compiled into a servlet, but it's simpler and more convenient than a pure servlet development page.
    3. Model2 architecture can actually be considered as what we call the Web MVC model, but the controller adopts servlet, the model adopts JavaBean, and the view uses JSP.
    4. service to workers, but also web MVC, is just more explicit. Front Controller + Application Controller + Page Controller + context Front Controller + Application Controller + page controllers (also known as actions) + context

MVC Model Overview (1)

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.