Java SSH Framework Learning (Getting started)

Source: Internet
Author: User

SSH is an integrated framework for struts+spring+hibernate, a popular open source framework for Java WEB applications in Java. Because I am most familiar with ASP. NET-like MVC and Python's Django framework, it is necessary today to learn about Java's popular framework ssh, in fact, as the overall framework of Web applications, I found that there are many similar places, For example, struts in this case is a foreground data filling module in Django's Views layer + template layer, and spring is the intermediate business logic layer connecting struts and hibernate, but this has been divided into views in Django. The last hibernate is a typical database mapping layer, which is similar to the Django models layer, that is, there is no Django simplification, read the blog and then summarize:

Struts

This is Java's MVC framework based on the Sun EE platform, which is mainly implemented using Servlet and JSP technology.

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

Spring

To address many of the problems common in the development of Java EE, Spring provides a consistent approach to managing business objects and encourages interface-oriented programming rather than class programming, based on the JavaBean property of the inersion of control container, String provides a unique data access abstraction, including a simple and efficient JDBC framework, string combined with hibernate and other O/R mapping solutions.

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

Hibernate

He is an open source object-relational mapping framework that provides JDBC with a very lightweight object encapsulation that allows Java programmers to manipulate the database at will using object programming thinking, and hibernate can replace CMP in the Java EE architecture of EJB to accomplish the task of data persistence.

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

In the combination mode of SSH, the respective roles of the three

Struts is a good MVC framework, and the main technique is that the MVC design patterns of servlets and jsp.struts can make our logic very clear and make the program hierarchical (similar to the views layer in Django).

Spring provides a way to manage the consistency of business objects and encourages programming of interfaces rather than classes, which is largely loosely coupled (already incorporated into the views layer).

Hibernate is used to persist data, provide comprehensive object-oriented database operations, Hibernate has a very lightweight JDBC encapsulation, so it is much easier to deal with the database (similar to the models layer in Django).

Many of these didn't see?, look directly at the SSH frame composition:

Struts is responsible for the Web tier:

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

Spring is responsible for the business logic layer, which is service:

The service provides a unified calling interface for action, encapsulates the persistence layer of DAO, and integrates hibernate, and spring can manage JavaBean (objects) and things uniformly.

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

Hibernate has a set of Hbm.xml and Po, which corresponds to the corresponding table in the database, and then defines DAO, which is the class that deals with the database. (Directly the complex models layer)

The following is an object invocation flowchart in SSH:

The primary data flow path is: Struts->spring->hibernate (jsp->action->service->dao->hibernate)

Reprint Address: http://blog.csdn.net/l_f0rm4t3d/article/details/23956247

Java SSH Framework Learning (Getting started)

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.