Introduction to "SPRINGMVC Architecture" SPRINGMVC (i)

Source: Internet
Author: User

Before writing this blog post, let me briefly explain the reasons for writing this series of blog posts, for the reasons of two.

    1. Bloggers have written a [SPRINGMVC+SPRING4+MYBATIS3 integration, development of simple Web project + source DOWNLOAD] (http://blog.csdn.net/jiuqiyuliang/article/details/ 45132493) article, simple and easy to understand, but for the Bo friends who have not contacted the SPRINGMVC frame, still have a certain difficulty.
    2. And in the last blog post, have Bo friends message, Hope: There is time to improve the tutorial. There is a picture for proof:

      Of course, thank you very much for the attention and support of this Bo friend, and here we begin today's content.

In this blog post, we focus on what is SPRINGMVC and what is MVC, and the detailed steps to implement MVC.

What is SPRINGMVC?

Before introducing SPRINGMVC, let's look at a very familiar diagram:

I believe that the bloggers who read this article have heard or used spring, and my previous article also explained in detail the spring's overall framework, as well as frameworks such as Ioc,aop,hibernate and MyBatis, JMS and so on, and spring itself supports the development of the DAO layer. , and even for the last Web module, we used struts, as well as JSPs, and so on.

What exactly is SPRINGMVC:
1. From the diagram above, the first of the Web modules is Spring Web MVC, in fact Springmvc is a module of the spring framework that we can see from the overall structure of spring.
2. Springmvc and struts1.x,2.x are both the framework of the presentation layer and the MVC-based web framework.

MVC-based web framework that looks pretty tall, don't be afraid, let's look at what MVC is.

What is MVC?

In introducing struts, we have simply introduced MVC, which was relatively shallow at the time, and this time we went into an in-depth introduction to MVC.

To put it bluntly, MVC is a design pattern, the simplest web interface development, we just write a JSP page is done, but now the web is divided into three layers, the full name is the Model view Controller, models-Views (view)- The controller's abbreviation is designed for the framework of the system, the layering is clearer, the extensibility is stronger, and the coupling degree of the system is reduced.

Since MVC is a design pattern, it can be used either in the C/s (client server) mode or in the B/s (browser server) mode. Below we introduce the application in B/S mode, as follows:

Let's take a detailed look at the implementation steps of MVC and the role of each part in this diagram:

MVC Execution Steps
    1. The user initiates a request to the controller, the controller receives the user's request, and delegates the request to the model for processing.
    2. The controller request model, the model processes the business data and obtains the processing result, the model usually refers to the business logic, including Pojo, Service, DAO and so on three layers
    3. The model returns processing results to the controller
    4. The controller shows the model data in the view
      Description: The model in the Web cannot display data directly on the view and needs to be done through the controller. If the model is in the C/s application, the data can be displayed in the view.
    5. The controller responds to the result of the view, response it to the user, shows the user data through the view, or processes the result.
The role of the various parts of MVC

We know the implementation steps of MVC, and we simply summarize the role of the various parts of MVC:
1. Role of Controller
Encapsulates a Web request as a data object, invokes the business logic layer to process the data object, returns processing data results, and a corresponding view to the user.
2. Role of model
Process business data and return processing results
3. The role of view
Renders the view and presents the data or processing results to the user

Summarize

This blog post we know, what is SPRINGMVC, and more in-depth introduction of MVC, I believe you have a deep understanding of MVC.

Next blog post, we do a simple example of SPRINGMVC, so please look forward to it.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Introduction to "SPRINGMVC Architecture" SPRINGMVC (i)

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.