web.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<display-name></display-name>
<!-- 配置spring -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring.xml</param-value> </context-param>
<!--
第二种解决方案openSessionInViewInterceptor -->
<filter>
<filter-name>openSessionInView</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>openSessionInView</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 开启监听 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 配置struts -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<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>
</web-app>
sping.xml配置
<context:component-scan
base-package="hx"/>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="oracle.jdbc.driver.OracleDriver">
</property>
<property name="url"
value="jdbc:oracle:thin:@localhost:1521:orcl">
</property>
<property name="username"
value="xiaohai"></property>
<property name="password"
value="123"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</prop>
</props> </property>
<property name="packagesToScan">
<list> <value>hx.vo</value>
</list> </property>
</bean> <bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory"
ref="sessionFactory"></property> </bean>
<tx:annotation-driven transaction-manager="txManager"/>
</beans> struts.xml零配置!
struts2.1.8+spring2.5+hibernate3.2注解配置,布布扣,bubuko.com
struts2.1.8+spring2.5+hibernate3.2注解配置
原文:http://www.cnblogs.com/huanghaixiong/p/3579675.html