JAVA & #160; SSH & #160; Framework introduction, brief sh framework Introduction

Source: Internet
Author: User

Introduction to the java ssh framework and the mongosh framework

SSH is an integrated framework of struts + spring + hibernate. It is a popular open-source JAVA Web application framework.

Struts

Struts is an MVC framework based on the Sun J2EE platform. It is mainly implemented using Servlet and JSP technologies. Because Struts can fully meet the needs of application development, it is easy to use and agile, and has received a lot of attention in the past year. Struts integrates Servlet, JSP, custom tags, and message resources into a unified framework. Developers do not need to code themselves to implement a full set of MVC patterns during development, it saves a lot of time, so Struts is a very good application framework.

Official Address: http://struts.apache.org

Spring

Spring is a powerful framework that solves many common problems in J2EE development. Spring provides consistent methods for managing business objects and encourages injection of good habits of interface programming rather than class programming. Spring's architecture is based on the Inversion of Control container using the JavaBean attribute. However, this is only part of the complete picture: Spring is unique in the use of IOC containers as a complete solution to build a focus on all architecture layers. Spring provides a unique data access abstraction, including a simple and efficient JDBC framework, which greatly improves efficiency and reduces possible errors. Spring's Data Access architecture also integrates Hibernate and other O/R mapping solutions. Spring also provides a unique transaction management abstraction that provides a consistent programming model for various underlying transaction management technologies, such as JTA or JDBC transactions. Spring provides an AOP framework written in the standard Java language, which provides POJOs with declarative transaction management and other enterprise transactions-if you need to-implement your own aspects. This framework is powerful enough to allow applications to get rid of the complexity of ejbs and enjoy key services related to traditional ejbs. Spring also provides a powerful and flexible MVC Web framework that can be integrated with IoC containers.

Official Address: spring: http://www.springsource.org

Hibernate

Hibernate is an open-source object relationship ing framework that encapsulates JDBC objects in a lightweight manner, so that Java programmers can use the object programming thinking to manipulate the database as they wish. Hibernate can be used in any scenario where JDBC is used. It can be used in both Java client programs and Servlet/JSP Web applications. The most revolutionary thing is that, hibernate can replace CMP in the J2EE architecture of application EJB to fulfill the task of data persistence.

Official Address: http://www.hibernate.org

Roles of the three in the SSH combination framework mode

Struts is a good MVC Framework. Its main technologies are Servlet and Jsp. The MVC design pattern of Struts can make our logic clear and let the program we write have a clear hierarchy.

Spring provides a consistent method for managing business objects, and encourages injection of good habits of interface programming rather than class programming to maximize decoupling of our products.

Hibernate is used to persist data and provides fully object-oriented database operations. Hibernate implements a very lightweight encapsulation of JDBC, making it easy to deal with relational databases.

The following is an SSH architecture diagram:


SSH Architecture

 

Struts is responsible for the Web layer:

ActionFormBean receives the data submitted by the form in the web page, and then processes the data through the Action, and then Forward to the corresponding web page, defines the <action-mapping> In the Struts-config.xml, ActionServlet will load in.

Spring is responsible for business layer management, that is, Service:

Service provides a unified Calling Interface for Action, encapsulates DAO in the persistent layer, and integrates Hibernate. Spring can manage JavaBean and things in a unified manner.

Hibernate is responsible for the persistence layer to complete database CRUD operations:

Hibernate has a set of hbm. xml files and PO, which correspond to tables in the database and then define DAO, which are classes dealing with databases.

In the Struts + Spring + Hibernate system, the call process between objects is as follows:

Struts --> Spring --> Hibernate
JSP --> Action --> Service --> DAO --> Hibernate

Struts is responsible for the Web layer:

ActionFormBean receives the data submitted by the form in the web page, and then processes the data through the Action, and then Forward to the corresponding web page, defines the <action-mapping> In the Struts-config.xml, ActionServlet will load in.

Spring is responsible for business layer management, that is, Service:

Service provides a unified Calling Interface for Action, encapsulates DAO in the persistent layer, and integrates Hibernate. Spring can manage JavaBean and things in a unified manner.

Hibernate is responsible for the persistence layer to complete database CRUD operations:

Related Article

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.