struts+spring+hibernate主要包括applicationContex.xml、web.xml、struts-config.xml这个三个文件的配置。
 三个文件的配置如下:
     applicationContex.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 http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">


 <bean id="dataSource"
  class="org.springframework.jndi.JndiObjectFactoryBean">
  <property name="jndiName" value="java:comp/env/jdbc/crm"></property>
 </bean>
 <bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource">
   <ref bean="dataSource" />
  </property>
  <property name="hibernateProperties">
   <props>
    <prop key="hibernate.dialect">
     org.hibernate.dialect.MySQLDialect
    </prop>
    <!-- 表示允许自动提交 -->
    <prop key="hibernate.connection.autocommit">true</prop>
    <!-- 显示sql语句 -->
    <prop key="hibernate.show_sql">true</prop>
   </props>
  </property>
  <property name="mappingResources">
   <list>
    <value>org/kwb/ssh/vo/CrmUser.hbm.xml</value>
    <value>org/kwb/ssh/vo/CrmTree.hbm.xml</value></list>
  </property>
 </bean>
 <bean id="hibernateTemplate"
     class="org.springframework.orm.hibernate3.HibernateTemplate">
     <property name="sessionFactory">
         <ref bean="sessionFactory"/>
     </property>
 </bean>
 
 <!-- crmuserdao的注入 -->
 <bean id="icrmuserdao"
  class="org.kwb.ssh.dao.ICrmUserDAO" abstract="true">
 </bean>
 <bean id="icrmuserdaoimpl"
  class="org.kwb.ssh.dao.impl.ICrmUserDAOImpl" parent="icrmuserdao">
  <property name="hibernateTemplate">
   <ref bean="hibernateTemplate"/>
  </property>
 </bean>
 <bean name="/login/crmUser"
  class="org.kwb.ssh.struts.action.CrmUserAction">
  <property name="icrmuserdao">
   <ref bean="icrmuserdaoimpl"/>
  </property>
 </bean>
 
 <!-- icrmtreedao 的注入  -->
 <bean id="icrmtreedao" class="org.kwb.ssh.dao.ICrmTreeDAO" abstract="true">
 </bean>
 <bean id="icrmtreedaoimpl"
  class="org.kwb.ssh.dao.impl.ICrmTreeDAOImpl" parent="icrmtreedao">
  <property name="hibernateTemplate">
   <ref bean="hibernateTemplate"/>
  </property> 
 </bean>
 
 <bean name="/menu/crmTree"
  class="org.kwb.ssh.struts.action.CrmTreeAction">
  <property name="icrmtreedao">
   <ref bean="icrmtreedaoimpl"/>
  </property>
 </bean>
 
</beans>


web.xml的配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <filter>
  <filter-name>encoding</filter-name>
  <filter-class>
   org.kwb.ssh.filter.EncodingFilter
  </filter-class>
  <init-param>
   <param-name>charset</param-name>
   <param-value>utf-8</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>encoding</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 <filter>
  <filter-name>opensession</filter-name>
  <filter-class>
   org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
  </filter-class>
 </filter>
 <filter-mapping>
  <filter-name>opensession</filter-name>
  <url-pattern>*.do</url-pattern>
 </filter-mapping>
   <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>
   /WEB-INF/classes/applicationContext.xml
  </param-value>
   </context-param>
   <servlet>
  <servlet-name>context</servlet-name>
  <servlet-class>
   org.springframework.web.context.ContextLoaderServlet
  </servlet-class>
  <load-on-startup>1</load-on-startup>
   </servlet>
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>3</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>3</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>/login/login.jsp</welcome-file>
  </welcome-file-list>
</web-app>

 struts-config.xml配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">

<struts-config>
  <data-sources />
  <form-beans >
    <form-bean name="crmUserForm" type="org.kwb.ssh.struts.form.CrmUserForm" />
    <form-bean name="crmTreeForm" type="org.kwb.ssh.struts.form.CrmTreeForm" />
   
  </form-beans>

  <global-exceptions />
  <global-forwards />
  <action-mappings >
    <action
      attribute="crmUserForm"
      input="/errors/errors.jsp"
      name="crmUserForm"
      parameter="status"
      path="/login/crmUser"
      scope="request"
      type="org.kwb.ssh.struts.action.CrmUserAction">
      <forward name="loginsuccess" path="/menu/crmTree.do?status=doGetFolderList"></forward>         
      <forward name="loginfailure" path="/login/login.jsp"></forward>
    </action>
    <action
      attribute="crmTreeForm"
      input="/errors/errors.jsp"
      name="crmTreeForm"
      parameter="status"
      path="/menu/crmTree"
      scope="request"
      type="org.kwb.ssh.struts.action.CrmTreeAction">
      <forward name="success" path="/index.jsp"></forward>
    </action>
    <action
      parameter="status"
      path="/languageChoose"
      type="org.kwb.ssh.struts.action.LanguageChooseAction">
      <forward name="success" path="/login/login.jsp"></forward>
    </action>
   
   

  </action-mappings>

  <controller
 processorClass="org.springframework.web.struts.DelegatingRequestProcessor">
  </controller>
  <message-resources parameter="org.kwb.ssh.struts.ApplicationResources" />
  <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
    <set-property property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml" />
  </plug-in>
</struts-config>

 tomcat的conf目录下的server.xml配置:
 <Context path="/crm" docBase="D:\crm\WebRoot"
  debug="5" reloadable="true" crossContext="true">
  <Logger className="org.apache.catalina.logger.FileLogger"
     prefix="localhost_MysqlTest_log." suffix=".txt"
     timestamp="true"/>
     <Resource name="jdbc/crm" type="javax.sql.DataSource" username="root" password="1234" driverClassName="org.gjt.mm.mysql.Driver" maxIdle="30" maxWait="100" url="jdbc:mysql://localhost:3306/crm" maxActive="5000"/>
 </Context>