Document directory
- Struts
- Spring
- Hibernate
- Roles of the three in the SSH combination framework mode
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 solution. 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
Link: http://www.admin10000.com/document/150.html