Struts2
引入struts所需的包:
struts2-core-2.3.4.1.jar   struts2核心包
xwork-core-2.3.4.1.jar  xwork核心包
antlr-2.7.2.jar
asm-3.3.jar
asm-commons-3.3.jar
asm-tree-3.3.jar
commons-fileupload-1.2.2.jar
commons-io-2.0.1.jar
ognl-3.0.5.jar
struts2-spring-plugin-2.3.4.1.jar  struts的spring插件
 
配置过滤器:
web.xml配置
 
 
< 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  >


Spring
引入spring所需的包:
org.springframework.core-3.1.2.RELEASE.jar
org.springframework.asm-3.1.2.RELEASE.jar
org.springframework.beans-3.1.2.RELEASE.jar
org.springframework.context.support-3.1.2.RELEASE.jar
org.springframework.context-3.1.2.RELEASE.jar
org.springframework.core-3.1.2.RELEASE.jar
org.springframework.expression-3.1.2.RELEASE.jar
org.springframework.jdbc-3.1.2.RELEASE.jar
org.springframework.orm-3.1.2.RELEASE.jar    封装了hibernate,ibatis等持久层框架
org.springframework.transaction-3.1.2.RELEASE.jar   封装了DAOSurpport
org.springframework.web.struts-3.1.2.RELEASE.jar  
org.springframework.web-3.1.2.RELEASE.jar  
 
 
web.xml中的配置(监听器):
< context-param >
    < param-name  > contextConfigLocation   param-name >
    < param-value  > /WEB-INF/classes/applicationContext.xml param-value  >
context-param >
< listener >
      < listener-class >  org.springframework.web.context.ContextLoaderListener  listener-class >
listener >
 
 
Hibernate3
 引入所需的包:
hibernate3.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
javassist-3.12.0.GA.jar
jta-1.1.jar
slf4j-api-1.6.1.jar
dom4j-1.6.1.jar
 
SSH整合
1.spring 整合 struts
一、需要的JAR文件为:Spring和Struts2框架本身需要的JAR文件以及他们所依赖的JAR文件,比如commons-logging.jar等等,另外还需要Struts2发布包中的struts2-spring-plugin-x.xx.jar。

二、在web.xml中增加WebApplicationContext的相应配置,以下两种配置方式本质是一样的。
1.         Servlet 2.3及以上版本可以使用监听器,相应配置如下:

              contextConfigLocation
              /WEB-INF/classes/applicationContext.xml


              org.springframework.web.context.ContextLoaderListener

如果spring配置文件被命名为applicationContext.xml,并且放在WEB-INF目录下,则不需要配置,因为ContextLoaderListener默认在WEB-INF目录下寻找名为applicationContext.xml的文件。若存在多个Spring配置文件,则在中依次列出,之间以逗号隔开。
 
 
2.spring整合hibernate
 
applicationContext.xml如下:
 
xml  version = "1.0"  encoding =  "UTF-8" ?>
DOCTYPE  beans  PUBLIC
     "-//SPRING//DTD BEAN 2.0//EN"
     "http://www.springframework.org/dtd/spring-beans-2.0.dtd"  >

< beans >

     < bean  id = "sessionfactory"
         class = "org.springframework.orm.hibernate3.LocalSessionFactoryBean"  >
         < property  name = "configLocation"  >
             < value >  classpath:hibernate.cfg.xml value  >
         property >
       
         < property  name = "dataSource"  >  
              < ref  bean = "dataSource"  />  
       property  >
     bean  >
   
     < bean  id = "dataSource"  class = "org.springframework.jdbc.datasource.DriverManagerDataSource"  >
         < property  name = "driverClassName"  >
          < value >  com.mysql.jdbc.Driver value  >
         property >
         < property  name = "url"  >
          < value >  jdbc:mysql://localhost:3306/test value  >
         property >
         < property  name = "username"  value = "root" >  property >
         < property  name = "password"  value = "123456" >  property >
        bean >

beans >


hibernate.cfg.xml如下:
DOCTYPE  hibernate-configuration  PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"  >
 
  < hibernate-configuration  >
 
      < session-factory  >
 
         
        
 
         
          < property  name = "dialect"  > org.hibernate.dialect.MySQLDialect   property >
 
         
          < property  name = "current_session_context_class"  > thread   property >
 
         
          < property  name = "show_sql"  > true   property >
 
         
          < property  name = "hbm2ddl.auto"  > create   property >
 
          < mapping  resource = "user.xml"  />
 
      session-factory  >
 
  hibernate-configuration  >