spring beans.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"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<!-- 创建数据源(c3p0) -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="oracle.jdbc.driver.OracleDriver" />
<property name="jdbcUrl" value="jdbc:oracle:thin:@127.0.0.1:1521:orcl" />
<property name="user" value="klm" />
<property name="password" value="klm123" />
</bean>
<!-- 开启注解 -->
<context:annotation-config/>
<!-- 设置扫描包 -->
<context:component-scan base-package="com.card.memberSystem"/>
<!-- 使用注解配置AspectJ,先注册aspectj -->
<aop:aspectj-autoproxy/>
<!-- 使用注解配置事物 ,tx的transaction-manager属性默认值就是"transactionManager"-->
<tx:annotation-driven transaction-manager="txManager"/>
<!-- 配置sessionfactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
p:dataSource-ref="dataSource" p:configLocations="classpath:hibernate.cfg.xml"/>
<!-- 实例化事务管理器 -->
<bean id="txManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 配置事务的传播特性 ,指定事务管理器 -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<!-- 配置详细的事务语义 -->
<tx:attributes>
<tx:method name="find*" read-only="true" propagation="REQUIRED" />
<tx:method name="*" read-only="false" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<!-- 配置切面 (系统管理)-->
<aop:config>
<aop:pointcut id="pc" expression="execution(* com.card.memberSystem.business.systemSet.service.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="pc"/>
</aop:config>
<!-- 配置切面 (会员管理)-->
<aop:config>
<aop:pointcut id="mempc" expression="execution(* com.card.memberSystem.business.memberManage.service.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="mempc"/>
</aop:config>
<!-- 配置切面 (商品管理)-->
<aop:config>
<aop:pointcut id="productpc" expression="execution(* com.card.memberSystem.business.productManage.service.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="productpc"/>
</aop:config>
<!-- 配置切面 (礼品兑换)-->
<aop:config>
<aop:pointcut id="giftpc" expression="execution(* com.card.memberSystem.business.giftExchange.service.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="giftpc"/>
</aop:config>
<!-- 配置切面 (会员消费)-->
<aop:config>
<aop:pointcut id="meConpc" expression="execution(* com.card.memberSystem.business.memberConsume.service.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="meConpc"/>
</aop:config>
<!-- 配置切面 (统计报表)-->
<aop:config>
<aop:pointcut id="staRConpc" expression="execution(* com.card.memberSystem.business.staReport.service.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="staRConpc"/>
</aop:config>
<!-- 配置切面 (增值服务)-->
<aop:config>
<aop:pointcut id="valueService" expression="execution(* com.card.memberSystem.business.valueService.service.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="valueService"/>
</aop:config>
</beans>
hibernate hibernate.cfg.xml
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- <property name="current_session_context_class">thread</property> -->
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
<!-- 0 = TRANSACTION_NONE 1 = TRANSACTION_READ_UNCOMMITTED 2 = TRANSACTION_READ_COMMITTED
4 = TRANSACTION_REPEATABLE_READ 8 = TRANSACTION_SERIALIZABLE -->
<property name="connection.isolation">2</property>
<!-- <mapping resource="com/card/memberSystem/business/base/entity/Emp.hbm.xml"/>
<mapping resource="com/card/memberSystem/business/base/entity/Dept.hbm.xml"/> -->
<mapping resource="com/card/memberSystem/business/base/entity/Role.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Muser.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Shop.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Member.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Grade.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Rechargerecord.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Product.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Productstock.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Productcatagory.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Inventorychangerecord.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Meal.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Mealproject.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Rechargecountrecord.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Refinterecord.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Proshop.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Gift.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Giftexchangerecord.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/MeConsum.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Returns.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Employee.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Mealbuyrecord.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Payway.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Empcomrecord.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Consumerecord.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Productallocaterecord.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Proinstock.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/ProAllocate.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Proinstockdetail.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Integralchange.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Countcon.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Fastcon.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Mehint.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Customattributes.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Log.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Smsmodel.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Systemparameter.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Proptable.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Propvalue.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Recomintegral.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Productsalerecord.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Sms.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Notice.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Shopnotice.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Wei.hbm.xml" />
<mapping resource="com/card/memberSystem/business/base/entity/Yuyue.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/SetMealRec.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Changeclass.hbm.xml" />
<mapping
resource="com/card/memberSystem/business/base/entity/Auth.hbm.xml" />
</session-factory>
</hibernate-configuration>
Struts2 struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<!-- 是否支持动态方法调用:false表示不允许使用动态方法调用 1:暴露bean类,不安全 2会覆盖structs传过来的通配符-->
<constant name="struts.objectFactory" value="spring" /> <!-- 对象工厂改成spring -->
<package name="default" namespace="/" extends="json-default">
<!-- 贾冬林 -->
<interceptors>
<!-- 配置自定义拦截器 -->
<interceptor name="myInterceptor" class="com.tebuy.interceptor.myInterceptor"/>
<!-- 配置拦截器栈 -->
<interceptor-stack name="myInterceptorStack">
<interceptor-ref name="myInterceptor"/>
</interceptor-stack>
<interceptor name="logInterceptor"
class="com.tebuy.interceptor.LoggerInterceptor" />
</interceptors>
<action name="cart_*" class="cartAction" method="{1}">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="myInterceptorStack">
</interceptor-ref>
<result name="login">/login.jsp</result>
<result name="success">/cart.jsp</result>
</action>
<action name="order_*" class="orderAction" method="{1}">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="myInterceptorStack">
</interceptor-ref>
<result name="success">/order.jsp</result>
<result name="ok">/ok.jsp</result>
</action>
<!--xsc -->
<action name="user_*" class="userAction" method="{1}">
<result name="success">/home/anquan.jsp</result>
<interceptor-ref name="defaultStack" />
<interceptor-ref name="logInterceptor">
<param name="excludeMethods">safe</param>
</interceptor-ref>
<result name="json" type="json">
<param name="root">listUserBean</param>
</result>
<result name="next" type="redirect">user_backUser.action</result>
</action>
<action name="managerOp_*" class="managerOpAction" method="{1}">
<result name="json" type="json">
<param name="root">ManagerOpBean</param>
</result>
</action>
<action name="userIp_*" class="homeAnQuanAction" method="{1}">
<result name="success">/home/ajaxanquan.jsp</result>
</action>
<action name="backuserIp_*" class="speUserIpBackAction" method="{1}">
<result name="allIpJson" type="json">
<param name="root">backUserIpBeanList</param>
</result>
<result name="totalIp" type="json">
<param name="root">backUserIpBeanList</param>
</result>
</action>
<action name="backUserComment_*" class="backUserIndexAction" method="{1}">
<result name="allUserComment" type="json">
<param name="root">backUserCommentBeanList</param>
</result>
</action>
<!-- 贾冬林 -->
<!-- 注意:这里的class必须写spring中配置的action的id名,因为这时,由spring来生成action对象 -->
<action name="product_*" class="productAction" method="{1}">
<result>detail.jsp</result>
</action>
<action name="BackAD_*" class="backADAction" method="{1}">
<result name="listAd" type="redirect">/teback/backmain.jsp</result>
</action>
<!-- 老謝登錄 -->
<action name="speuser_*" class="loginAction" method="{1}">
<result name="onlyLogin">/${url}</result>
<result name="success" type="redirect">${url}</result>
<result name="fail">/login.jsp</result>
</action>
<action name="userIp_*" class="homeAnQuanAction" method="{1}">
<result name="success">/home/ajaxanquan.jsp</result>
</action>
<!--管理员 -->
<action name="admin_*" class="adminAction" method="{1}">
<result name="success" type="redirect" >/teback/backmain.jsp</result>
<result name="fail">/adminLogin.jsp</result>
<result name="allAdmin" type="json">
<param name="root">backAdminBeanList</param>
</result>
<result name="addAdminJson" type="json">
<param name="root">r</param>
</result>
<result name="updateJson" type="json">
<param name="root"></param>
</result>
</action>
<!--xsc的首页Comment -->
<action name="comment_*" class="backIndexAction" method="{1}">
<result name="fiveCommentJson" type="json">
<param name="root">backCommentBeanList</param>
</result>
</action>
<!-- ck首页order -->
<action name="backIndexOrder_listFiveOrder" class="backIndexOrderAction" method="listFiveOrder">
<result name="fiveOrderJson" type="json">
<param name="root">backOrderListBeanList</param>
</result>
</action>
<action name="backIndexOrder_listFiveSales" class="backIndexOrderAction" method="listFiveSales">
<result name="fiveSalesJson" type="json">
<param name="root">backOrderListBeanList1</param>
</result>
</action>
<!-- ck个人后台首页order -->
<action name="userBackIndexOrder_listFiveOrderById" class="userBackIndexOrderAction" method="listFiveOrderById">
<result name="fiveOrderJson" type="json">
<param name="root">userBackOrderListBeanList</param>
</result>
</action>
<action name="userBackIndexOrder_listFiveSalesById" class="userBackIndexOrderAction" method="listFiveSalesById">
<result name="fiveSalesJson" type="json">
<param name="root">userBackOrderListBeanList1</param>
</result>
</action>
<!-- zzg -->
<action name="ListAction_*" class="listAction" method="{1}">
<result name="success">/ajaxlist.jsp</result>
</action>
<action name="UserHomeAction_*" class="userHomeAction" method="{1}">
<result name="success">/ajaxuserlist.jsp</result>
</action>
<!-- end -->
<!-- wanyunhua 订单 -->
<action name="Homeorder_*" class="homeOrderAction" method="{1}">
<result name="success" type="redirect">/home/myorder.jsp</result>
<result name="ok" type="redirectAction">Homeorder_showOrder.action</result>
<result name="mid">/showfen.jsp</result>
</action>
<!-- zzg Address-->
<action name="UserAddressAction_*" class="userAddressAction" method="{1}">
<result name="infoJson" type="json">
<param name="root">speUserAddresss</param>
</result>
<result name="useraddressJson" type="json">
<param name="root">speUserAddress</param>
</result>
</action>
<!-- zzg -->
<!-- 后台 后台 后台 万云华后台 begin -->
<action name="backorder_*" class="backOrderListAction" method="{1}">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="logInterceptor"/>
<result name="listAlljson" type="json">
<param name="root">backOrderListBeanList</param>
</result>
<result name="listWfhjson" type="json">
<param name="root">backOrderListBeanList</param>
</result>
<result name="listYfhjson" type="json">
<param name="root">backOrderListBeanList</param>
</result>
<result name="listWpjjson" type="json">
<param name="root">backOrderListBeanList</param>
</result>
<result name="listYwcjson" type="json">
<param name="root">backOrderListBeanList</param>
</result>
<!-- 用户区域 -->
<result name="userlistAll" type="json">
<param name="root">backOrderListBeanList</param>
</result>
<result name="userlistWfhjson" type="json">
<param name="root">backOrderListBeanList</param>
</result>
<result name="listuserYfhjson" type="json">
<param name="root">backOrderListBeanList</param>
</result>
<result name="listuserWpj" type="json">
<param name="root">backOrderListBeanList</param>
</result>
<result name="listuserYwc" type="json">
<param name="root">backOrderListBeanList</param>
</result>
</action>
<!-- 下面是商品管理 -->
<action name="backgood_*" class="backGoodAction" method="{1}">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="logInterceptor"/>
<result name="Allgoods" type="json">
<param name="root">backGoodBeanList</param>
</result>
<!-- 用户商品 -->
<result name="usergoodAll" type="json">
<param name="root">backGoodBeanList</param>
</result>
</action>
<!-- 后台 后台 后台 万云华后台 end -->
<!-- zzg -->
<action name="BaikeAction_list" class="baikeAction" method="list">
<result name="success">/baike/ajaxseachvalue.jsp</result>
</action>
<action name="BaikeAction_search" class="baikeAction" method="search">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="logInterceptor"/>
<result name="success">/baike/baikedetail.jsp</result>
</action>
<action name="BaikeAction_list" class="baikeAction" method="list">
<result name="success">/baike/ajaxseachvalue.jsp</result>
</action>
<action name="BaikeAction_search" class="baikeAction" method="search">
<result name="success">/baike/baikedetail.jsp</result>
</action>
<action name="BackDataCommentAction_*" class="backDataCommentAction" method="{1}">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="logInterceptor"/>
<result name="listjson" type="json">
<param name="root">backDataCommentBeanList</param>
</result>
<result name="deletejson" type="json">
<param name="root">flag</param>
</result>
</action>
<action name="BackDataDictionaryAction_*" class="backDataDictionaryAction" method="{1}">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="logInterceptor"/>
<result name="listjson" type="json">
<param name="root">backDictionaryBeanList</param>
</result>
<result name="addson" type="json">
<param name="root">flag</param>
</result>
</action>
<action name="BackDataOrderAction_*" class="backDataOrderAction" method="{1}">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="logInterceptor"/>
<result name="listjson" type="json">
<param name="root">backDataOrderBean</param>
</result>
</action>
<action name="BackHistoryAction_*" class="backHistoryAction" method="{1}">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="logInterceptor"/>
<result name="listjson" type="json">
<param name="root">backDataHistoryBean</param>
</result>
</action>
<action name="BackDataCartItemAction_*" class="backDataCartItemAction" method="{1}">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="logInterceptor"/>
<result name="listjson" type="json">
<param name="root">backDataCartBean</param>
</result>
</action>
<action name="BackDataProductAction_*" class="backDataProductAction" method="{1}">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="logInterceptor"/>
<result name="listjson" type="json" >
<param name="root">backDataProductBeanList</param>
</result>
</action>
<!-- zzgend -->
<!-- ck reg -->
<action name="Reg_reg" class="com.tebuy.action.RegAction" method="reg">
<result name="fail">/register.jsp</result>
<result name="0">/login.jsp</result>
</action>
<!-- ck 实名认证 -->
<action name="HomeSafe_renzheng" class="com.tebuy.action.HomeSafeAction" method="renzheng">
<result name="fail" >/register.jsp</result>
<result name="success">/login.jsp</result>
</action>
<!-- ck 修改密码 -->
<action name="HomeSafe_updatepwd" class="com.tebuy.action.HomeSafeAction" method="updatepwd">
<result name="fail">/register.jsp</result>
<result name="success">/login.jsp</result>
</action>
<!-- ck mail -->
<action name="Reg_getValideCodeByEmail" class="com.tebuy.action.RegAction" method="getValideCodeByEmail">
<result name="json" type="json">
<param name="root">jsondata</param>
</result>
</action>
<!-- ck姓名表单 -->
<action name="Reg_findUserByName" class="com.tebuy.action.RegAction" method="findUserByName">
<!-- <result name="have" >
</result>
<result name="no"></result> -->
<result name="json" type="json">
<param name="root">0</param>
<param name="root2">1</param>
</result>
<!-- <result name="0" type="json">
<param name="root"></param>
</result>
<result name="1" type="json"></result> -->
</action>
</package>
</struts>
web.xml 配置
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>mberSystem</display-name>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/beans.xml</param-value>
</context-param>
<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>