Struts2+hibernate+spring (SSH) Three framework integration Jar Package

Source: Internet
Author: User
Tags log4j

Struts2 + Spring3 + Hibernate3 Framework Integration


1. Use of each frame (development environment construction)
* Presentation Layer Frame STRUTS2
1) Jar Package import: Apps/struts2_blank.war contains struts2 to develop the most basic jar package
Struts2-convention-plugin-2.3.7.jar for struts using annotations (if not developed with annotations, no import required)
Struts2-json-plugin-2.3.7.jar for STRUTS2 Integrated Ajax
Struts2-spring-plugin-2.3.7.jar for STRUTS2 Integration Spring (integrated spring must be imported)

2) Web. XML Config Strut2 core filter
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

3) Create Struts.xml (core profile) in SRC directory

2) Configure the Web. XML listener to load the spring configuration
<listener>
<!--load Web-inf/applicationcontext.xml by default--
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>

3) Create applicationcontext.xml under SRC
4) Create log4j.properties under SRC

*hibernate3.6
1) Jar Package Import
Hibernate3.jar
Required/*.jar
Hibernate-jpa-2.0-api-1.0.1.final.jar
C3P0 + MySQL Driver
Integrated log4j import SLF4J integrated jar package Slf4j-log4j12-1.7.2.jar
(because spring has been imported log4j no need to import again)
Second-level cache
Ehcache-1.5.0.jar
Commons-logging.jar
Backport-util-concurrent.jar

2) Create hibernate.cfg.xml under SRC
3) Create the class name in the package where the PO class is located. hbm.xml

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.