配置文件的分析:
web.xml中的配置
<!--定义Spring的配置-->
<context-param>
<param-name>
contextConfigLocation
</param-name>
<param-value>
classpath*:applicationContext-*.xml
</param-value>
</context-param>
<!--配置监听器-->
<listener>
<listener-class></listener-class>
</listener>
<!--OpenSessionInViewFilter-->
<filter>
<filter-name></filter-name>
<filter-class></filter-class>
</filter>
<filter-mapping>
<filter-name></filter-name>
<url-pattern></url-pattern>
</filter-mapping>
struts.xml的配置文件
<struts>
<package name="" namespace="" extends="">
<action name="xxx" class="xxxAction">
<result name="">/xx.jsp</result>
</action>
<!--通配符的引用-->
<action name="*" class="{1}Action">
<result name="">/{1}_xx.jsp</result>
</action>
</package>
</struts>
applicationContext-common.xml配置文件(包括Hibernate和Spring的配置)
<beans>
<!--启用注解注入-->
<context:annotation-config/>
<!--启用注解扫描-->
<context:component-scan base-package="包名"/>
<!--配置数据库-->
<bean id="dataSource" class="">
<property name="driverClassName" value=""/>
<property name="url"/ value="">
<property name="username" value=""/>
<property name="password" value=""/>
</bean>
<!--配置Spring的SessionFactory-->
<bean id="" class="">
<property name="dataSource" ref="dataSource">
<property name="hibernateProperties">
<value>
</value>
</property>
<property name="mappingResource">
<list>
<value>com/oa/model/类名.hbm</value>
</list>
</property>
</bean>
<!--配置事务管理-->
<bean id="txManager" class="">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!--配置事务通知-->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attribute>
<tx:method name="find*" read-only="true"/>
<tx:method name="get*" read-only="true"/>
<tx:method name="*"/>
</tx:attribute>
</tx:advice>
<!--配置事务切面-->
<aop:config>
<aop:pointcut id="fooServiceOperation" ref=""/>
</aop:config>
</beans>
common.xml的配置
<struts>
<constant name="" value="struts-default"/>
<package name="" abstract="true" extends="struts-default">
<interceptors>
<interceptor name="" class=""/>
<interceptors>
<interceptor-stack name="">
<interceptor-ref name=""/>
</interceptor-stack>
<!--定义全局变量-->
<global-results>
<result name=""/>
</global-results>
<!--定全局异常-->
<global-exception-mappings>
<exception-mapping result="" exception=""/>
</global-exception-mappings>
</package>
</struts>