<?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="loginForm" type="cn.com.ssh.form.LoginForm" /> </form-beans> <global-exceptions /> <global-forwards /> <action-mappings> <action attribute="loginForm" input="/index.jsp" name="loginForm" path="/login" scope="request" type="org.springframework.web.struts.DelegatingActionProxy"> <forward name="success" path="/welcome.jsp"></forward> </action> </action-mappings> <message-resources parameter="cn.com.ssh.ApplicationResources"/> <!--表示要载入的配置文件,用于整合spring框架,多配置文件用逗号隔开--> <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"> <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml"/> </plug-in></struts-config> <?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.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName"> <value>oracle.jdbc.driver.OracleDriver</value> </property> <property name="url"> <value>jdbc:oracle:thin:@192.168.126.28:1521:dev</value> </property> <property name="username"> <value>zj</value> </property> <property name="password"> <value>zj</value> </property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="mappingResources"> <list> <value>cn/com/ssh/dao/entity/ZjZUser.hbm.xml</value></list> </property> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> </props> </property> </bean> <!-- <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="configLocation"> <value>classpath:hibernate.cfg.xml</value> </property> </bean> --> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate" > <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <bean id="myTransaction" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> <bean id="tasactionTemplate" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true"> <property name="transactionManager" ref="myTransaction"></property> <property name="transactionAttributes"> <props> <prop key="insert*">PROPAGATION_REQUIRED</prop> <prop key="save">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="edit*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="query*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="userdao" class="cn.com.ssh.dao.UserDao"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <bean id="usertarget" class="cn.com.ssh.service.UserService"> <property name="userDao"> <ref bean="userdao"/> </property> </bean> <bean id="userservice" parent="tasactionTemplate"> <property name="target"> <ref bean="usertarget"/> </property> </bean> <bean name="/login" class="cn.com.ssh.action.LoginAction"> <property name="service"> <ref bean="userservice"/> </property> </bean> <!-- <bean id="interceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <property name="transactionManager" ref="myTransaction"></property> <property name="transactionAttributes"> <props> <prop key="insert*">PROPAGATION_REQUIRED</prop> <prop key="save">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="edit*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="query*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="beanNames"> <list> <value>usertarget</value> </list> </property> <property name="interceptorNames"> <list> <value>interceptor</value> </list> </property> </bean> --></beans>