SSH Framework Introduction and how to build (Eclipse)

Source: Internet
Author: User
Tags object object java web java se

First, SSH is an integrated framework of three frameworks for Struts 2+spring+hibernate , a popular open-source integration framework for Web applications that builds flexible, easy-to-scale, multi-tiered Web applications. is currently a popular open source framework for Java Web applications.

1.JAVA EE

Java EE is one of the most popular platforms for developing enterprise-class (WEB) applications today, and is a platform to bring all of Sun's enterprise technologies together in one architecture. Java currently has three platforms:
Ø Java Platform for small devices and smart cards Micro version (Java Platform micro Edition,java ME) Ø Java Platform Standard Edition for desktop systems (Java Platform standard Edition,java SE) Ø the Java Platform Enterprise Edition (Java Platform Enterprise Edition,java EE) for creating server applications and services.
Java EE application hierarchy:
    • Presentation layer: This layer consists of a series of JSP pages, velocity pages, and PDF document view components that collect user requests and display processing results.
    • Controller layer: This layer consists of series controllers used to intercept user requests and invoke business logic methods of business logic components, process user requests, and forward to different presentation layer components based on processing results.
    • Business Logic Layer: This layer consists of a series of business logic objects. The business logic object implements the business logic method required by the system. These business logic methods may be business logic methods that rely on DAO components, or may only be used to expose the business logic methods implemented by the domain object object.
    • Data Access Object,dao layer: This layer consists of a series of DAO that implements atomic operations such as creating, querying, updating, and Deleting (CRUD) the database.
    • Domain object layer: This layer consists of a series of Pojo (Plain old Java object, plain traditional Java objects)

2.SSH Frame

The system of integrated SSH framework is divided into four layers: presentation layer, business logic layer, data persistence layer and Domain module layer (entity layer) Struts 2 for Process Control, spring for business flow, hibernate for database operation encapsulation. The overall framework and the business layer are used in spring, the presentation layer is struts, and the persistent layer is hibernate.

Struts is a good MVC framework, with the main technology being servlets and JSPs. The MVC design pattern of struts can make our logic very clear, let us write the program hierarchy.

Spring provides a consistent way to manage business objects and encourages the injection of good habits into programming the interface rather than programming the class, decoupling our products to the fullest extent possible.

Hibernate is used to persist data, providing fully object-oriented database operations. Hibernate is a very lightweight package for JDBC, making it easy to deal with relational databases.

The following is an SSH frame composition:

Struts is responsible for the Web tier:

Actionformbean receives the data submitted by the form in the webpage, then processes it through the action, then forward to the corresponding webpage, and defines <action-mapping> in Struts-config.xml; Actionservlet will load in.

Spring is responsible for business layer management, which is service:

The service provides a unified calling interface for action, encapsulates the persistence layer of DAO, and integrates hibernate,spring to manage javabean and things uniformly.

Hibernate takes care of the persistence layer and completes the database CRUD operations:

Hibernate has a set of hbm.xml files and po that correspond to the tables in the database, and then define DAO, which is the class that deals with the database.

In the struts+spring+hibernate system, the invocation flow between objects is as follows:

Struts-->spring-->hibernate
Jsp-->action-->service-->dao-->hibernate

SSH Framework Introduction and how to build (Eclipse)

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.