struts2.1.8 + spring2.5.6 + hibernate3.3.2整合的..qqq.

来源:百度文库 编辑:神马文学网 时间:2024/04/28 12:13:44
struts2.1.8 + spring2.5.6 + hibernate3.3.2整合的登陆 带 jar包  此次整合的版本是:struts2.1.8 + spring2.5.6 + hibernate3.3.2
一.先整合hibernate和spring:

============================================================

hibernate所需要jar包:

antlr- 2.7.6.jar、commons-collections-3.1.jar、dom4j-1.6.1.jar、hibernate3.jar、 javassist-3.9.0.GA.jar、jta-1.1.jar、slf4j-api-1.5.8.jar、log4j.jar、slf4j- log4j12-1.5.8.jar (slf4j接口以log4j形式实现),因为采用了注解的方式所以还需(annotation3.4的包):ejb3- persistence.jar、hibernate-annotations.jar、hibernate-commons- annotations.jar、hibernate-entitymanager.jar、hibernate-validator.jar、 jboss-archive-browsing.jar ,采用了c3p0连接池,还需要:c3p0-0.9.1.2.jar

========================================================================

spring所需要jar包:spring.jar、commons-logging.jar ,spring注解需要:common-annotations.jar ,aop需要:aspectjrt.jar、aspectjweaver.jar、cglib-nodep-2.1_3.jar

hibernate.cfg.xml配置:

1.  
2. 3.           "-//Hibernate/Hibernate Configuration DTD 3.0//EN" 
4.           "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> 
5.  
6.  
7.  
8.      
9.          
10.             org.hibernate.dialect.MySQLDialect 
11.        
 
12.          
13.             jdbc:mysql://localhost:3306/oa 
14.        
 
15.         root 
16.         root 
17.          
18.             com.mysql.jdbc.Driver 
19.        
 
20.         mysql5 
21.         true 
22.         thread 
23.         update 
24.  
25.          
26.          
27.             org.hibernate.connection.C3P0ConnectionProvider 
28.        
 
29.          
30.         20 
31.          
32.         2 
33.          
34.         5000 
35.          
36.         100 
37.          
38.         1000 
39.          
40.         2 
41.          
42.         true 
43.          
44.          
45.  
46.    
 
47.  
48.


==========================================================
applicationContext.xml配置如下:

1.  
2. 3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 
4.     xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" 
5.     xsi:schemaLocation="http://www.springframework.org/schema/beans  
6.            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
7.            http://www.springframework.org/schema/context 
8.            http://www.springframework.org/schema/context/spring-context-2.5.xsd 
9.            http://www.springframework.org/schema/aop 
10.            http://www.springframework.org/schema/aop/spring-aop-2.5.xsd 
11.            http://www.springframework.org/schema/tx 
12.            http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> 
13.             
14.      
15.      
16.     17.         class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> 
18.          
19.        
 
20.    
 
21.      
22.      
23.          
24.    
 
25.      
26.      
27.      
28.


========================================================================
再加入struts2:

加入包:xwork-core-2.1.6.jar、 struts2-core-2.1.8.jar、ognl-2.7.3.jar、freemarker-2.3.15.jar、commons-io- 1.3.2.jar、commons-fileupload-1.2.1.jar、struts2-spring-plugin-2.1.8.jar

web.xml如下设置:

1.  
2. 3.     xmlns="http://java.sun.com/xml/ns/javaee"  
4.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
5.     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  
6.     http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 
7.      
8.      
9.        contextConfigLocation 
10.        classpath:applicationContext.xml 
11.    
 
12.      
13.      
14.           org.springframework.web.context.ContextLoaderListener 
15.    
 
16.          

struts2
org.apache.struts2.dispatcher.FilterDispatcher


struts2
/*

25.          
26.      
27.         encoding 
28.         org.springframework.web.filter.CharacterEncodingFilter 
29.          
30.             encoding 
31.             UTF-8 
32.        
 
33.    
 
34.      
35.         encoding 
36.         /* 
37.    
 
38.          
39.                          
40.      
41.             OpenSessionInViewFilter 
42.             org.springframework.orm.hibernate3.support.OpenSessionInViewFilter 
43.    
 
44.      
45.             OpenSessionInViewFilter 
46.             /* 
47.    
 
48.      
49.


struts.xml如下:

1.  
2. 3.     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" 
4.     "http://struts.apache.org/dtds/struts-2.0.dtd"> 
5.  
6.  
7.  
8.      
9.      
10.      
11.      
12.      
13.      
14.      
15.      
16.      
17.      
18.      
19.      
20.  
21.      
22.          
23.          
24.             /WEB-INF/exceptionPage.jsp 
25.            
 
26.        
 
27.          
28.              
29.        
       
30.          
31.             /login.jsp 
32.        
 
33.    
 
34.  
35.      
36.          
37.          
38.             /WEB-INF/user/loginSuccess.jsp 
39.             /login.jsp 
40.        
 
41.    
 
42.  
43.



=======================================
**********************************************************************
使用的技术:spring2.0+struts2.0+hibernate3.0
spring2.0的JAR包:
1、spring-2.0.jar、
Struts2.0的JAR包:
1、struts2-core-2.0.11.1.jar;
2、struts2-spring-plugin-2.0.11.1.jar;
3、xwork-2.0.4.jar;
4、ognl-2.6.11.jar
5、freemarker-2.3.8.jar
hibernate3.0的JAR包:
1、hibernate3.jar
2、hibernate-annotations.jar
3、antlr-2.7.6.jar;
4、cglib-nodep-2.1_3.jar
5、commons-beanutils-1.7.0.jar

另外:连接数据库的两个Jar包:
1、commons-dbcp.jar;
2、commons-pool.jar

做事务的Jar包:
1、jta.jar;
解析XML文件:
1.dom4j.xml

====================================================================
**********************************************************************************************
ssh:Struts1.2 + Hibernate3.2 + Spring2.0

antlr-2.7.6rc1.jar
asm.jar
asm-attrs.jar
cglib-2.1.3.jar
commons-attributes-api.jar
commons-beanutils.jar
commons-codec.jar
commons-collections-2.1.1.jar
commons-dbcp.jar
commons-digester.jar
commons-discovery.jar
commons-fileupload.jar
commons-httpclient.jar
commons-io.jar
commons-lang.jar
commons-logging-1.0.4.jar
commons-pool.jar
commons-validator.jar
dom4j-1.6.1.jar
ehcache-1.1.jar
hibernate3.jar
jaas.jar
jaxen-1.1-beta-7.jar
jdbc2_0-stdext.jar
jstl.jar
jta.jar
junit-4.1.jar
log4j-1.2.11.jar
mysql-connector-java-5.1.7-bin.jar
spring.jar
spring-webmvc-struts.jar
standard.jar
struts.jar
xerces-2.6.2.jar
xml-apis.jar