SSH框架整合步驟:
 
1.建web project
2.匯入struts2.0的jar包(基本的五個加上struts2-spring-plugin-2.0.14.jar)
3.匯入spring的jar包,這裡加hibernate關聯的包,用myeclipse可以完成。
4.建hibernate的資料對映檔案
5.建自己要用到的業務類,action,jsp頁面。
6.配製web.xml,struts.xml,applicationContext.xml
web.xml檔案:

<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app version=”2.4″    
xmlns=”http://java.sun.com/xml/ns/j2ee”    
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”    
xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee    
[url]http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd[/url]”>
<!– 配置applicationContext.xml的路徑 –>
<!– 用於初始化Spring容器的Listener –>
<!– 定義Struts2的FilterDispathcer的Filter –>
<!– 定義整合SiteMesh必須的ActionContextCleanUp Filter –>
    
    

<!– 配置applicationContext.xml的路徑 –>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<!– 配置監聽,spring與struts關聯 –>
<!– 用於初始化Spring容器的Listener –>
<listener>
    <listener-class>
     org.springframework.web.context.ContextLoaderListener
    </listener-class>
</listener>
    
<!– 定義Struts2的FilterDispathcer的Filter –>
<filter>
    <filter-name>struts2</filter-name>
    <filter-class>
     org.apache.struts2.dispatcher.FilterDispatcher
    </filter-class>
</filter>
<!– 配置struts2.0的 cleanup–>
<!– 定義整合SiteMesh必須的ActionContextCleanUp Filter –>
<filter>
    <filter-name>struts-cleanup</filter-name>
    <filter-class>
     org.apache.struts2.dispatcher.ActionContextCleanUp
    </filter-class>
</filter>
<filter-mapping>
    <filter-name>struts-cleanup</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<!– FilterDispatcher用來初始化struts2並且處理所有的WEB請求。 –>
<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

struts.xml檔案:
<?xml version=”1.0″ encoding=”UTF-8″ ?>
<!DOCTYPE struts PUBLIC
        “-//Apache Software Foundation//DTD Struts Configuration 2.0//EN”
        “http://struts.apache.org/dtds/struts-2.0.dtd”>

<struts>
<package name=”default” extends=”struts-default”>
    <action name=”Login” class=”loginAction”>
     <result name=”input”>Login.jsp</result>
     <result name=”success”>success.jsp</result>
    </action>
    
</package>
</struts>

applicationContext.xml檔案:
<?xml version=”1.0″ encoding=”UTF-8″?>
<beans
xmlns=”http://www.springframework.org/schema/beans”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://www.springframework.org/schema/beans [url]http://www.springframework.org/schema/beans/spring-beans-2.0.xsd[/url]”>

<!– 定義dataSource –>
<!– 定義sessionFactory , 這裡要加hibernate的資料庫表的對映檔案***.hbm.xml –>
<!– 事務管理 –>
<!– 事務攔截器 –>
<!– 業務例項動態代理 –>
<!– 定義業務處理bean –>

<!– 定義dataSource,myeclipse配置完成 –>
<bean id=”dataSource”
    class=”org.apache.commons.dbcp.BasicDataSource”>
    <property name=”driverClassName”
     value=”com.microsoft.jdbc.sqlserver.SQLServerDriver”>
    </property>
    <property name=”url”
     value=”jdbc:microsoft:sqlserver://localhost:1433″>
    </property>
    <property name=”username” value=”sa”></property>
    <property name=”password” value=”sa”></property>
</bean>
<!– 定義sessionFactory,myeclipse配置完成 , 這裡要加hibernate的資料庫表的對映檔案***.hbm.xml –>
<bean id=”sessionFactory”
    class=”org.springframework.orm.hibernate3.LocalSessionFactoryBean”>
    <property name=”dataSource”>
     <ref bean=”dataSource” />
    </property>
    <property name=”mappingResources”>
     <list>
        <value>com/student/model/User.hbm.xml</value>
     </list>
    </property>
    <property name=”hibernateProperties”>
     <props>
        <prop key=”hibernate.dialect”>
         org.hibernate.dialect.SQLServerDialect
        </prop>
        <prop key=”hibernate.hbm2ddl.auto”>update</prop>
        <prop key=”hibernate.jdbc.batch_size”>20</prop>
     </props>
    </property>
</bean>
<!– 宣告事務,作用就是對一系列操作在執行時錯誤的情況能回滾 –>
<!– 事務管理 –>
<bean id=”transactionManager”
    class=”org.springframework.orm.hibernate3.HibernateTransactionManager”>
    <property name=”sessionFactory” ref=”sessionFactory” />
</bean>
    
        <!– 事務攔截器 –>
        <bean id=”transactionInterceptor”
    class=”org.springframework.transaction.interceptor.TransactionInterceptor”>
    <!–    事務攔截器bean需要依賴注入一個事務管理器 –>
    <property name=”transactionManager” ref=”transactionManager” />
    <property name=”transactionAttributes”>
     <!–    下面定義事務傳播屬性–>
     <props>
        <prop key=”get*”>PROPAGATION_REQUIRED,readOnly</prop>
        <prop key=”*”>PROPAGATION_REQUIRED</prop>
     </props>
    </property>
</bean>
        
        <!– 業務例項動態代理 –>
<!– 定義BeanNameAutoProxyCreator–>
<bean
    class=”org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator”>
    <!–    指定對滿足哪些bean name的bean自動生成業務代理 –>
    <property name=”beanNames”>
     <!–    下面是所有需要自動建立事務代理的bean–>
     <list>
        <value>userManager</value>
     </list>
     <!–    此處可增加其他需要自動建立事務代理的bean–>
    </property>
    <!–    下面定義BeanNameAutoProxyCreator所需的事務攔截器–>
    <property name=”interceptorNames”>
     <list>
        <!– 此處可增加其他新的Interceptor –>
        <value>transactionInterceptor</value>
     </list>
    </property>
</bean>
    
    
<!– 定義業務處理bean –>
<bean id=”userManager”
    class=”com.student.service.UserManagerImpl”>
    <property name=”userDao” ref=”userDao” />
</bean>

<bean id=”userDao” class=”com.student.dao.UserDaoHibernate”>
    <property name=”sessionFactory” ref=”sessionFactory” />
</bean>

 
<!– 這裡一定要加:scope = “prototype”,否則action例項不會更新–>

<bean id=”loginAction” class=”com.student.action.LoginAction” scope = “prototype”>
    <property name=”userManger” ref=”userManager” />
</bean>
    

    
    
</beans>

 
以上是一個大致的流程,關鍵是SSH有相關jar包要匯入正確,還有就是上面的三個配置檔案比較重要,這兩點沒有問題,SSH配置就基本OK。
 
這裡只是給出了一個簡單流程,給剛學習struts2.0+spring+hibernate的朋友一些參考,希望有所幫助,共同學習,相互交流。