Eclipse Integration Spring 4 + Struts 2.5 + Hibernate 4.2

Source: Internet
Author: User

The construction of the SSH Project source code has been uploaded to Baidu cloud disk. Without maven, download it down, and under ApplicationContext configuration MySQL, execute the next Test.sql script to run it.

Links: http://pan.baidu.com/s/1nvqOcPj

Password: yv19

1. Configure Struts2
A. Copy Struts2 jar Package
B. Set JSP encoding to UTF-8
C. Add struts2 Filter to Web. xml
D. Add struts.xml to src directory
E. Adding a test action to test whether the STRUTS2 is configured successfully
2. Configure Spring3
A. Copy the jar that the Spring3 depends on (note: Remove the redundant jar and keep the high version)
B. Adding applicationcontext.xml to the SRC directory
C. Writing a simple test case to test if spring is configured successfully
3. Configure Hibernate
A. Copy the jar that Hibernate relies on (again, note to delete duplicate jars, keep the high version), the packages that the JPA depends on, the packages that the C3P0 connection pool depends on
B. Adding a database-driven jar (example MySQL)
C. Add hibernate.cfg.xml (Configure Hibernate database connection, configure C3P0 connection pool)
D. Adding a Log4j.property file
E. in MySQL execution Test.sql, it is only necessary to create a table called T_test, there is only one ID field. Here you only need to test hibernate configuration OK
F. Add an entity field called Test T_test table corresponding to
G. Adding a test class entity to a Hibernate.cfg.xml file
4. Integrating STRUTS2 and Spring
A. Integration solution--STRUTS2 is responsible for the request response process, and spring is responsible for action creation
B. Add Struts2-spring-plugin-2.5.10.1.jar
C. Adding @component to the Testaction class
D. Modify Web. XML, add spring Contextloadlistener, add contextconfiglocation profile parameters, add log4j configuration parameters
E. Modify the Struts2.xml to set the class property of the action to spring's automatically created bean name
5. Integrating Spring with hibernate (C3P0)
A. Integration scenario--spring is responsible for creating sessionfactory, configuring connection pooling, configuring declarative transactions
B. Add Spring-orm-4.3.8.release.jar
C. Connect the database in Hibernate.cfg.xml and configure the data source in Applicationcontext.xml
D. Configuring the Sessionfactory Bean, transaction manager

Eclipse Integration Spring 4 + Struts 2.5 + Hibernate 4.2

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.