Introduction to the JAVA SSH framework

Source: Internet
Author: User

Reprinted from: http://www.admin10000.com/document/150.html

SSH is an integrated framework for struts+spring+hibernate, which is now a popular open source framework for Java Web applications.

Struts

Struts is an MVC framework based on the Sun EE platform, which is implemented mainly by servlet and JSP technology. Because struts can fully meet the needs of application development, easy-to-use, agile and rapid, over the past year has been a considerable concern. Struts consolidates Servlets, JSPs, custom tags, and information resources into a single, unified framework that developers use to develop without having to code their own full set of MVC patterns, saving time So struts is a very good application framework.

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

Spring

Spring is a powerful framework that solves many of the problems that are common in the development of Java EE. Spring provides a consistent approach to managing business objects and encourages the good habit of injecting programming to interfaces rather than classes. The schema base of spring is based on the inversion of control container that uses the JavaBean property. However, this is only part of the complete Picture: Spring is unique in using the IOC container as a complete solution to all architectural 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 across a variety of underlying transaction management techniques, such as JTA or JDBC transactions. Spring provides an AOP framework written in the standard Java language that provides POJOs with declarative transaction management and other enterprise transactions-if you need it-to implement your own aspects. This framework is powerful enough to allow applications to throw away the complexity of EJBS while enjoying the critical services associated with 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-relational mapping framework that provides JDBC with a very lightweight object encapsulation that allows Java programmers to manipulate databases at will using object programming thinking. Hibernate can be applied to any JDBC application, both in Java client applications and in servlet/jsp Web applications, and most revolutionary is that hibernate can replace CMP in the EE architecture of the EJB application. The task of achieving data persistence.

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

The role of each of the three in SSH's combined framework model

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:


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

JAVA SSH Framework Introduction (GO)

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.