For Struts control
Hibernate operations database.
Spring uses a decoupled
The role of Struts, spring and Hibernate in each layer
1) 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 and Forward it to the corresponding page.
The <ACTION-MAPPING> is defined in Struts-config.xml, and Actionservlet is loaded.
2) Spring is responsible for business layer management, i.e. service (or manager).
1. The service provides a statistical calling interface for the action, encapsulating the DAO for the persistence layer.
2. Can write some of their own business methods.
3. A unified approach to JavaBean management
4. Declarative transaction Management
5. Integrated Hiberante
3) Hiberante, responsible for persistence layer, complete the database crud operation
Hibernate is a persistent layer that provides or/mapping.
It has a set of. hbm.xml files and POJO that correspond to the tables in the database. Then you define DAO, which is the class that deals with the database, and they use the PO.
In the Struts+spring+hibernate system,
The calling process for an object is: Jsp-> Action-> Service->dao->hibernate.
The flow of data is Actionformbean accepts the user's data, the Action takes the data out of the Actionfrombean, encapsulates it into VO or PO,
Then call the business layer of the Bean class, complete a variety of business processing and then forward. When the business layer Bean receives the PO object, it invokes the DAO interface method for persistence.
SPRING:AOP Management Transaction Control, IOC manages the coupling of various components, daotemplate as a rapid development template for regular persistence layer!
Struts: Control layer Action, page label and model data, calling the business layer
Hibernate: Responsible for database and object mapping, the DAO layer (data Access object)
Spring integrates hibernate and struts, as long as the applicationcontext.xml is well-equipped and is called directly in the struts action. Hibernate access to the database is implemented in spring, and spring's call is implemented in the Stuts action.
The three frames of struts, hibernate, and spring are detailed.