applicationContext.xml
代码语言:javascript复制<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!-- sessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml">
</property>
</bean>
<!-- dao -->
<bean id="UserinfoDAO" class="com.dao.impl.UserinfoDaoImpl">
<property name="sessionFactory">
<ref bean="sessionFactory"></ref>
</property>
</bean>
<bean id="PositionDAO" class="com.dao.impl.PositionDAO">
<property name="sessionFactory">
<ref bean="sessionFactory"></ref>
</property>
</bean>
<bean id="DeptDAO" class="com.dao.impl.DeptDAO">
<property name="sessionFactory">
<ref bean="sessionFactory"></ref>
</property>
</bean>
<bean id="EmployeeDAO" class="com.dao.impl.EmployeeDaoImpl">
<property name="sessionFactory">
<ref bean="sessionFactory"></ref>
</property>
</bean>
<!-- ===============biz=============== -->
<bean id="All_Biz" class="com.biz.impl.All_Biz">
<property name="empDao" ref="EmployeeDAO"></property>
<property name="uiDao" ref="UserinfoDAO"></property>
</bean>
<bean id="EmployeeBiz" class="com.biz.impl.EmployeeBizImpl" parent="All_Biz"></bean>
<bean id="UserInfoBiz" class="com.biz.impl.login_UserInfo_BizImpl" parent="All_Biz"></bean>
<!-- ===============action=============== -->
<bean id="Employee_action" class="com.action.All_Action">
<property name="empbiz" ref="EmployeeBiz"></property>
<property name="uibiz" ref="UserInfoBiz"></property>
</bean>
<bean id="employee_action" class="com.action.Employee_Action" parent="Employee_action" scope="prototype"></bean>
<bean id="login_action" class="com.action.login_UserInfo_Action" parent="Employee_action" scope="prototype"></bean>
<!-- ===================通用事务====================== -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<tx:advice id="tx">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="login*" propagation="SUPPORTS" />
<tx:method name="*" propagation="SUPPORTS" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut expression="execution(* com.biz.impl.*.*(..))"
id="bizMethod" />
<aop:advisor advice-ref="tx" pointcut-ref="bizMethod" />
</aop:config>
</beans>
hibernate.cfg.xml
代码语言:javascript复制<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="dialect
org.hibernate.dialect.Oracle9Dialect
</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1522:accp11g</property>
<property name="connection.username">baiyu</property>
<property name="connection.password">123</property>
<property name="connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<property name="myeclipse.connection.profile">baiyu</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<mapping resource="com/orm/Userinfo.hbm.xml" />
<mapping resource="com/orm/Position.hbm.xml" />
<mapping resource="com/orm/Dept.hbm.xml" />
<mapping resource="com/orm/Employee.hbm.xml" />
</session-factory>
</hibernate-configuration>
struts.xml
代码语言:javascript复制<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<include file="com/config/struts-list.xml"></include>
<include file="com/config/struts-login.xml"></include>
</struts>