On the relationship between MVC design pattern and SSH framework

Source: Internet
Author: User

One. MVC: Refers to model-View-controler, is a hierarchical mode of the program, is a kind of thought.

      MVC Yes model - view - controler mvc

MVC the models, views, and controllers in each of them carry different tasks.

View : A view is an interface that the user sees and interacts with. The view displays the relevant data to the user and accepts the user's input . The data that needs to be displayed can be either static data or dynamic data that is stored in the domain object by the server. There is actually no business logic processing happening in the view, it's just a way of outputting data and allowing the user to manipulate it.

      model :   The model represents business data and business processing javabean mvc

Controller : The controller accepts the user's input and invokes the model and view to complete the user's needs. So when a user clicks a hyperlink in a Web page and sends an HTML form, the controller itself does not output anything and does any processing. It simply accepts the request and decides which model component is called to process the request, and then determines which view to use to display the data returned by the model processing.

MVC process: First the controller accepts the user's request, invokes the corresponding model for business processing, and returns the data to the controller. The controller invokes the corresponding view to display the result of the processing and renders it to the user through the view.

first, the controller receives the user's request, and decides which model should be called for processing, then the model uses the business logic to process the user's request and returns the data, and the controller returns the number of the model with the corresponding view format and presented to the user through the presentation layer.                            


Two. SSH: Refers to struts2,spring,hibernate, is three kinds of encapsulated framework, is the implementation of framework mode, SSH is a classic MVC pattern.


SSH: The system of the integrated SSH framework is divided into four layers: the presentation layer, the business logic layer, the data persistence layer and the Domain module layer, in order to help the developers to build a clear, reusable and easy-to-maintain web application in a short period of time. It uses struts as the overall infrastructure of the system, is responsible for the separation of MVC, controls the business jump in the model part of the Struts framework, supports the persistence layer with the Hibernate framework, manages the spring, manages struts and hibernate. By using object-oriented analysis method, we propose some models, implement these models as basic Java objects, and then write the basic DAO (Data Access Objects) interface, and give the implementation of hibernate. The DAO class implemented by the hibernate architecture implements conversion and access between Java classes and databases, and finally manages struts and hibernate with spring.

The basic business process of the system is:

In the presentation layer, the interface is first implemented via a JSP page, responsible for receiving requests and transmitting responses (response), and then struts based on the configuration file (Strtus-config.xml) Delegate the request received by Actionservlet to the appropriate action handle.

In the business layer, the spring IOC container that manages the serviced component is responsible for providing the action with the business model component and the component's collaboration Object data Processing "DAO" components to complete the business logic and to provide container components such as transaction processing, buffer pooling to improve system performance and ensure data integrity.

In the persistence layer, it relies on Hibernate's object mapping and database interaction, processing the data requested by the DAO component, and returning the processing results.


Three. The relationship between MVC and SSH

MVC three-tier architecture: Model layer, control layer, and view layer. In the model layer, the Hibernate framework allows JavaBean to generate tables and associations in the database, manipulate the database through the operation of the JavaBean, view layer, display the page to the user with the JSP template, and provide the interaction with the user; control layer, Use the Strust framework to connect data and view layers for receiving, processing, sending data, and controlling processes. The spring framework, which sticks to hibernate and struts, transparently manages the entire architecture, providing the IOC container for loosely coupled code and the facets of the AOP framework, among other things.


This article is from the "9329792" blog, please be sure to keep this source http://9339792.blog.51cto.com/9329792/1684797

On the relationship between MVC design pattern and SSH framework

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.