Struts-config.xmls:
<?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>
<!-- 供应商Form -->
<form-beans>
<form-bean name="providerForm" type="ectss.control.form.ProviderForm"></form-bean>
<form-bean name="providerListForm" type="ectss.control.form.ProviderListForm"></form-bean>
<!-- ProductForm -->
<form-bean name="pForm" type="ectss.control.form.ProductForm"></form-bean>
<!-- OrderForm -->
<form-bean name="oForm" type="ectss.control.form.OrderForm"></form-bean>
<!-- Catrgory Form -->
<form-bean name="cForm" type="ectss.control.form.CategoryForm"></form-bean>
</form-beans>
<action-mappings>
<!-- 供应商Action ++++++++++++++++++++++++-->
<!-- 添加供应商 -->
<action path="/addprovider" type="ectss.control.action.ProductAction" name="providerForm" parameter="add" >
<forward name="SUCCESS" path="supplierslist.jsp"></forward>
<forward name="ERROR" path="addsupplier.jsp"></forward>
</action>
<!-- 查询供应商 -->
<action path="/findprovider" type="ectss.control.action.ProductAction" name="providerListForm" parameter="findByname" >
<forward name="SUCCESS" path="supplierslist.jsp"></forward>
<forward name="ERROR" path="addsupplier.jsp"></forward>
</action>
<!-- 修改供应商 -->
<action path="/updateprovider" type="ectss.control.action.ProductAction" name="providerListForm" parameter="updateProvider" >
<forward name="SUCCESS" path="supplierslist.jsp"></forward>
<forward name="ERROR" path="addsupplier.jsp"></forward>
</action>
<!-- 删除供应商 -->
<action path="/deleteprovider" type="ectss.control.action.ProductAction" name="providerListForm" parameter="deleteProvider" >
<forward name="SUCCESS" path="supplierslist.jsp"></forward>
<forward name="ERROR" path="addsupplier.jsp"></forward>
</action>
<!-- 查询所有商品 -->
<action path="/findproduct" type="ectss.control.action.ProductAction" name="providerListForm" parameter="findproduct" >
<forward name="SUCCESS" path="suppproduct.jsp"></forward>
<forward name="ERROR" path="addsupplier.jsp"></forward>
</action>
<!-- Action -->
<!-- 商品模块+++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<!-- 查找所有商品 -->
<action path="/findAllProduct" type="ectss.control.action.ProductAction" name="pForm" parameter="showProducts">
<forward name="showProducts" path="/productsList.jsp"></forward>
<forward name="error" path="/error.jsp"></forward>
</action>
<!-- 查询供应商 商品分类-->
<action path="/showPC" type="ectss.control.action.ProductAction" parameter="showPro" name="pForm">
<forward name="showPC" path="/findAllProduct.do"></forward>
<forward name="error" path="/error.jsp"></forward>
</action>
<!-- 添加商品 -->
<action path="/addProduct" type="ectss.control.action.ProductAction" parameter="addProducts" name="pForm">
<forward name="addProducts" path="/findAllProduct.do"></forward>
</action>
<!-- 删除商品 -->
<action path="/deletePro" type="ectss.control.action.ProductAction" parameter="deleteProduct">
<forward name="deleteProduct" path="/findAllProduct.do"></forward>
</action>
<!-- 商品分类模块+++++++++++++++++++++++++++++++++++++++++ -->
<!-- 查询商品分类 -->
<action path="/showCa" type="ectss.control.action.CategoryAction" parameter="FindCategory">
<forward name="AddCategory" path="/productsType.jsp"></forward>
<forward name="error" path="/error.jsp"></forward>
</action>
<!-- 删除商品分类 -->
<action path="/deleteCa" type="ectss.control.action.CategoryAction" parameter="deleteCategory">
<forward name="deleteCategory" path="/showCa.do"></forward>
<forward name="error" path="/error.jsp"></forward>
</action>
<!-- 添加商品分类 -->
<action path="/AddCategory" type="ectss.control.action.CategoryAction" parameter="AddCategory" name="cForm">
<forward name="AddCategory" path="/error.jsp"></forward>
<forward name="error" path="/error.jsp"></forward>
</action>
<!-- 订单模块 +++++++++++++++++++++++++++++++++++++++++-->
<!-- 查询所有订单ID -->
<action path="/findNewOrder" type="ectss.control.action.OrderAction" parameter="FindAllOrderId">
<forward name="newOrder" path="/newOrder.jsp"></forward>
<forward name="ERROR" path="/error.jsp"></forward>
</action>
</action-mappings>
<controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor"></controller>
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
</plug-in>
</struts-config>
ApplicationContext.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.5.xsd ">
<!-- 配置datasource -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
<property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:XE"></property>
<property name="username" value="system"></property>
<property name="password" value="admin"></property>
</bean>
<!-- 配置sessionFactory -->
<bean id = "sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="mappingResources">
<list>
<!-- 会员模块 -->
<value>ectss/model/xml/Province.hbm.xml</value>
<value>ectss/model/xml/User.hbm.xml</value>
<value>ectss/model/xml/UserInfo.hbm.xml</value>
<value>ectss/model/xml/AccountRate.hbm.xml</value>
<value>ectss/model/xml/AccountStatus.hbm.xml</value>
<value>ectss/model/xml/Country.hbm.xml</value>
<!-- 管理模块 -->
<value>ectss/model/xml/Admin.hbm.xml</value>
<value>ectss/model/xml/AdminType.hbm.xml</value>
<!-- 商品模块 -->
<value>ectss/model/xml/PayWay.hbm.xml</value>
<value>ectss/model/xml/Product.hbm.xml</value>
<value>ectss/model/xml/Provider.hbm.xml</value>
<value>ectss/model/xml/Category.hbm.xml</value>
<!-- 订单模块 -->
<value>ectss/model/xml/Order.hbm.xml</value>
<value>ectss/model/xml/OrderLine.hbm.xml</value>
<value>ectss/model/xml/OrderStatus.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
</props>
</property>
</bean>
<bean id = "hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id = "transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- DAO注入 -->
<!-- 管理员DAO注入 -->
<bean id = "AdminDao" class="ectss.model.daoimp.AdminDaoImp">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<!-- 商品类型DAO注入 -->
<bean id = "CategoryDao" class="ectss.model.daoimp.CategoryDaoImp">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<!-- 订单DAO注入 -->
<bean id = "OrderDao" class="ectss.model.daoimp.OrderDaoImp">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<!-- 商品DAO -->
<bean id = "ProductDao" class="ectss.model.daoimp.ProductDaoImp">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<!-- 供应商DAO注入 -->
<bean id = "ProviderDao" class="ectss.model.daoimp.ProviderDaoImp">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<!--会员DAO -->
<bean id = "UserDao" class="ectss.model.daoimp.UserDaoImp">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<!-- BIZ注入 -->
<!-- 管理员BIZ注入 -->
<bean id = "AdminBiz" class="ectss.model.bizimp.AdminBizImp">
<property name="dao" ref="AdminDao"></property>
</bean>
<!-- 商品类型BIZ注入 -->
<bean id = "CategoryBiz" class="ectss.model.bizimp.CategoryBizImp">
<property name="categorydao" ref="CategoryDao"></property>
</bean>
<!-- 订单BIZ -->
<bean id = "OrderBiz" class="ectss.model.bizimp.OrderBizImp">
<property name="orderDao" ref="OrderDao"></property>
</bean>
<!-- 商品BIZ -->
<bean id = "ProductBiz" class="ectss.model.bizimp.ProductBizImp">
<property name="productdao" ref="ProductDao"></property>
</bean>
<!-- 供应商BIZ -->
<bean id = "ProviderBiz" class="ectss.model.bizimp.providerBizImp">
<property name="providedao" ref="ProviderDao"></property>
</bean>
<!-- BIZ注入 -->
<!-- 会员BIZ -->
<bean id = "UserBiz" class="ectss.model.bizimp.UserBizImp">
<property name="dao" ref="UserDao"></property>
</bean>
<!-- 动态代理 -->
<!-- 管理员代理 -->
<bean id="dyadminbiz"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target" ref="AdminBiz"></property>
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- 商品类型动态代理 -->
<bean id="dycategorybiz"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target" ref="CategoryBiz"></property>
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- 订单动态代理 -->
<bean id="dyorderbiz" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target" ref="OrderBiz"></property>
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- 商品动态代理 -->
<bean id="dyproductbiz"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target" ref="ProductBiz"></property>
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- 供应商动态代理 -->
<bean id="dyproviderbiz"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target" ref="ProviderBiz"></property>
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- 会员动态代理 -->
<bean id="dyuserbiz"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target" ref="UserBiz"></property>
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- Acton 注入 -->
<!-- 订单模块****************************************-->
<!-- 新订单 -->
<bean name="/findNewOrder" class="ectss.control.action.OrderAction">
<property name="orderbiz" ref="dyorderbiz"></property>
</bean>
<!-- 商品模块 ********************************************-->
<!-- 查询 供应商 商品类型 -->
<bean name="/showPC" class="ectss.control.action.ProductAction">
<property name="biz1" ref="dycategorybiz"></property>
<property name="biz2" ref="dyproviderbiz"></property>
</bean>
<!-- 查询所有商品 -->
<bean name="/findAllProduct" class="ectss.control.action.ProductAction">
<property name="biz" ref="dyproductbiz"></property>
</bean>
<!-- 删除商品 -->
<bean name="/deletePro" class="ectss.control.action.ProductAction">
<property name="biz" ref="dyproductbiz"></property>
</bean>
<!-- 添加商品 -->
<bean name="/addProduct" class="ectss.control.action.ProductAction">
<property name="biz" ref="dyproductbiz"></property>
</bean>
<!-- 商品分类模块 -->
<!-- 查询所有商品分类 -->
<bean name="/showCa" class="ectss.control.action.CategoryAction">
<property name="biz" ref="dycategorybiz"></property>
</bean>
<!-- 删除商品分类 -->
<bean name="/deleteCa" class="ectss.control.action.CategoryAction">
<property name="biz" ref="dycategorybiz"></property>
</bean>
<!-- 添加商品 分类-->
<bean name="/AddCategory" class="ectss.control.action.CategoryAction">
<property name="biz" ref="dycategorybiz"></property>
</bean>
</beans>