- 浏览: 243950 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
问道721:
长见识了, 新建文档还不行, 写入内容后就可以了
利用poi操作word文档 -
laodongbao:
终于找到了我能理解和接受的的spring aop和动态代理的结 ...
spring Aop中动态代理 -
lqservlet:
可以看到存储文件! 全是xml文件,好多呀。
利用poi操作word文档 -
步青龙:
直接重命名xx.docx的文件为xx.zip,用WinRar打 ...
利用poi操作word文档 -
邦者无敌:
如果是JDK1.3呢?是否要将上面四个jar包手动加入
com.sun.crypto.provider.SunJCE
配置文件的书写
Struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="allForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="name" type="java.lang.String"/>
<form-property name="description" type="java.lang.String"/>
<form-property name="superBizId" type="java.lang.Integer"/>
<form-property name="businessId" type="java.lang.Integer"/>
<form-property name="superId" type="java.lang.Integer"/>
</form-bean>
</form-beans>
<global-forwards>
<forward name="error" path="/error.jsp"/>
</global-forwards>
<action-mappings>
<!-- about Business -->
<action path="/addBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="registerBusiness" name="allForm">
<forward name="ok" path="/selectBusiness.do" redirect="true"/>
</action>
<action path="/selectBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="findAllBusiness" name="allForm">
<forward name="ok" path="/showAllBusiness.jsp"/>
</action>
<action path="/selectBusinessByName" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectBusinessByName" name="allForm">
<forward name="ok" path="/showOneBusiness.jsp"/>
</action>
<action path="/toUpdateBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toUpdateBusiness" name="allForm">
<forward name="ok" path="/updateBusiness.jsp"/>
</action>
<action path="/updateBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="updateBusiness" name="allForm">
<forward name="ok" path="/selectBusiness.do"/>
</action>
<action path="/selectToAddBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="findAllBusiness">
<forward name="ok" path="/registerBusiness.jsp"/>
</action>
<action path="/selectToDeleteBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="findAllBusiness">
<forward name="ok" path="/deleteBusiness.jsp"/>
</action>
<action path="/selectToUpdateBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="findAllBusiness">
<forward name="ok" path="/toUpdateBusiness.jsp"/>
</action>
<action path="/toDeleteBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toDeleteBusiness" name="allForm">
<forward name="ok" path="/selectBusiness.do" redirect="true"/>
<forward name="hasProduct" path="/sureDeleteBusiness_product.jsp"/>
<forward name="hasBusiness" path="/sureDeleteBusiness_biz.jsp" />
</action>
<action path="/deleteBusinessSureProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="deleteBusinessSureProduct">
<forward name="ok" path="/selectBusiness.do" redirect="true"/>
</action>
<action path="/deleteBusinessSureBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="deleteBusinessSureBusiness" name="allForm">
<forward name="ok" path="/selectBusiness.do"/>
<forward name="hasProduct" path="/sureDeleteBusiness_product.jsp"/>
</action>
<!-- about Product -->
<action path="/selectBusinessForProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="findAllBusiness" name="allForm">
<forward name="ok" path="/addProduct.jsp"/>
</action>
<action path="/addProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="addProduct">
<forward name="ok" path="/selectAllProducts.do"/>
</action>
<action path="/selectAllProducts" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectAllProducts">
<forward name="ok" path="/showAllProducts.jsp"/>
</action>
<action path="/selectToDeleteProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectAllProducts">
<forward name="ok" path="/deleteProduct.jsp"/>
</action>
<action path="/toDeleteProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toDeleteProduct">
<forward name="ok" path="/selectAllProducts.do"/>
<forward name="haveProductPayType" path="/sureDeleteProduct.jsp"/>
</action>
<action path="/toDeleteAllProducts" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toDeleteAllProducts">
<forward name="ok" path="/success.jsp"/>
</action>
<action path="/selectToUpdateProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectAllProducts">
<forward name="ok" path="/toUpdateProduct.jsp"/>
</action>
<action path="/toUpdateProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toUpdateProduct">
<forward name="ok" path="/updateProduct.jsp"/>
</action>
<action path="/updateProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="updateProduct">
<forward name="ok" path="/selectAllProducts.do"/>
</action>
<action path="/toSelectProductByBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toSelectProductByBusiness">
<forward name="ok" path="/selectProductByBusiness.jsp"/>
</action>
<action path="/selectProductByBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectProductByBusiness">
<forward name="ok" path="/showSomeProducts.jsp"/>
</action>
<action path="/selectProductByName" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectProductByName">
<forward name="ok" path="/showSomeProducts.jsp"/>
</action>
<!-- about ProductPayType -->
<action path="/selectToAddProductPayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectToAddProductPayType">
<forward name="ok" path="/toAddProductPayType.jsp"/>
</action>
<action path="/toAddProductPayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toAddProductPayType">
<forward name="ok" path="/addProductPayType.jsp"/>
</action>
<action path="/addProductPayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="addProductPayType">
<forward name="ok" path="/selectAllProductPayTypes.do"/>
</action>
<action path="/selectAllProductPayTypes" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectAllProductPayTypes">
<forward name="ok" path="/showAllProductPayTypes.jsp"/>
</action>
<action path="/selectToDeletePPT" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectToDeletePPT">
<forward name="ok" path="/toDeletePPT.jsp"/>
</action>
<action path="/deletePPTById" type="org.springframework.web.struts.DelegatingActionProxy" parameter="deletePPTById">
<forward name="ok" path="/selectAllProductPayTypes.do"/>
</action>
<action path="/toDeletePPTByProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toDeletePPTByProduct">
<forward name="ok" path="/toDeletePPTByProduct.jsp"/>
</action>
<action path="/deletePPTByProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="deletePPTByProduct">
<forward name="ok" path="/deletePPTByProduct.jsp"/>
</action>
<action path="/trueDeletePPTByProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="trueDeletePPTByProduct">
<forward name="ok" path="/selectAllProductPayTypes.do"/>
</action>
<action path="/selectToUpdatePPT" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectToUpdatePPT">
<forward name="ok" path="/toUpdatePPT.jsp"/>
</action>
<action path="/toUpdatePPT" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toUpdatePPT">
<forward name="ok" path="/updatePPT.jsp"/>
</action>
<action path="/updatePPT" type="org.springframework.web.struts.DelegatingActionProxy" parameter="updatePPT">
<forward name="ok" path="/selectAllProductPayTypes.do"/>
</action>
<action path="/toDeletePPTByPayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toDeletePPTByPayType">
<forward name="ok" path="/deletePPTByPayType.jsp"/>
</action>
<action path="/deletePPTByPayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="deletePPTByPayType">
<forward name="ok" path="/selectAllProductPayTypes.do"/>
</action>
<action path="/toSelectPPTByProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toSelectPPTByProduct">
<forward name="ok" path="/toSelectPPTByProduct.jsp"/>
</action>
<action path="/sureSelect" type="org.springframework.web.struts.DelegatingActionProxy" parameter="sureSelect">
<forward name="ok" path="/showSomeProductPayTypes.jsp"/>
</action>
<action path="/selectPPTByProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectPPTByProduct">
<forward name="ok" path="/trueSelectPPTByProduct.jsp"/>
</action>
<action path="/trueSelectPPTByProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="trueSelectPPTByProduct">
<forward name="ok" path="/showSomeProductPayTypes.jsp"/>
</action>
<action path="/toSelectPPT" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toSelectPPT">
<forward name="ok" path="/toSelectPPT.jsp"/>
</action>
<!-- about PayType -->
<action path="/addPayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="addPayType">
<forward name="ok" path="/selectAllPayTypes.do"/>
</action>
<action path="/selectAllPayTypes" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectAllPayTypes">
<forward name="ok" path="/showAllPayTypes.jsp"/>
</action>
<action path="/selectToUpdatePayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectAllPayTypes">
<forward name="ok" path="/toUpdatePayType.jsp"/>
</action>
<action path="/toUpdatePayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toUpdatePayType">
<forward name="ok" path="/updatePayType.jsp"/>
</action>
<action path="/updatePayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="updatePayType">
<forward name="ok" path="/selectAllPayTypes.do"/>
</action>
<action path="/selectToDeletePayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectAllPayTypes">
<forward name="ok" path="/toDeletePayType.jsp"/>
</action>
<action path="/toDeletePayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toDeletePayType">
<forward name="ok" path="/selectAllPayTypes.do"/>
<forward name="havePPT" path="/sureDeletePayType.jsp"/>
</action>
<action path="/sureDeletePT" type="org.springframework.web.struts.DelegatingActionProxy" parameter="sureDeletePT">
<forward name="ok" path="/selectAllPayTypes.do"/>
</action>
<!-- about BuyFlow -->
<action path="/sendCartOrder" type="org.springframework.web.struts.DelegatingActionProxy" parameter="recieveOrder">
<forward name="ok" path="/bfpages/userLogin.jsp"/>
</action>
<action path="/userLogin" type="org.springframework.web.struts.DelegatingActionProxy" parameter="userLogin">
<forward name="ok" path="/findValidPayType.do"/>
</action>
<action path="/registerUser" type="org.springframework.web.struts.DelegatingActionProxy" parameter="registerUser">
<forward name="ok" path="/findValidPayType.do"/>
</action>
<action path="/findValidPayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="findValidPayType">
<forward name="ok" path="/bfpages/showValidPayTypes.jsp"/>
</action>
<action path="/toPay" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toPay">
<forward name="ok" path="/bfpages/surePay.jsp"/>
</action>
<action path="/chinaPay" type="org.springframework.web.struts.DelegatingActionProxy" parameter="chinaPay">
<forward name="ok" path="/bankService.do"/>
</action>
<action path="/bankService" type="org.springframework.web.struts.DelegatingActionProxy" parameter="bankService">
<forward name="ok" path="/reciveResponse.do"/>
</action>
<action path="/reciveResponse" type="org.springframework.web.struts.DelegatingActionProxy" parameter="reciveResponse">
<forward name="ok" path="/bfpages/getResponse.jsp"/>
</action>
</action-mappings>
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml"/>
</plug-in>
</struts-config>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>
com.my.web.SysListener
</listener-class>
</listener>
<filter>
<filter-name>encoding</filter-name>
<filter-class>com.kettas.upp.background.util.EncodingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
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.0.xsd">
<!-- Golobal -->
<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:@127.0.0.1:1521:XE">
</property>
<property name="username">
<value>haofeng</value>
</property>
<property name="password">
<value>haofeng</value>
</property>
<property name="maxActive">
<value>10</value>
</property>
<property name="maxIdle">
<value>3</value>
</property>
<property name="minIdle">
<value>1</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="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>
<property name="mappingResources">
<list>
<value>com/kettas/upp/background/entity/PayType.hbm.xml</value>
<value>com/kettas/upp/background/entity/Product.hbm.xml</value>
<value>com/kettas/upp/background/entity/Business.hbm.xml</value>
<value>com/kettas/upp/background/entity/ProductPayType.hbm.xml</value>
<value>com/kettas/upp/background/entity/PayOrder.hbm.xml</value>
<value>com/kettas/upp/background/entity/UserAccount.hbm.xml</value>
<value>com/kettas/upp/background/entity/SubUserAccount.hbm.xml</value>
<value>com/kettas/upp/background/entity/AccountStream.hbm.xml</value>
</list>
</property>
</bean>
<!--
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
-->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="businessDao" class="com.kettas.upp.background.dao.impl.BusinessDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="payTypeDao" class="com.kettas.upp.background.dao.impl.PayTypeDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="productDao" class="com.kettas.upp.background.dao.impl.ProductDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="productPayTypeDao" class="com.kettas.upp.background.dao.impl.ProductPayTypeDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="userAccountDao" class="com.kettas.upp.background.dao.impl.UserAccountDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="subUserAccountDao" class="com.kettas.upp.background.dao.impl.SubUserAccountDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="accountStreamDao" class="com.kettas.upp.background.dao.impl.AccountStreamDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="payOrderDao" class="com.kettas.upp.background.dao.impl.PayOrderDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="productBiz" class="com.kettas.upp.background.biz.impl.ProductBizImpl">
<property name="productdao">
<ref local="productDao"/>
</property>
</bean>
<!--
<bean id="productBizProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target">
<ref local="productBiz"/>
</property>
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
-->
<bean id="productPayTypeBiz" class="com.kettas.upp.background.biz.impl.ProductPayTypeBizImpl">
<property name="productpaytypedao">
<ref local="productPayTypeDao"/>
</property>
</bean>
<!--
<bean id="productPayTypeBizProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target">
<ref local="productPayTypeBiz"/>
</property>
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
-->
<bean id="payTypeBiz" class="com.kettas.upp.background.biz.impl.PayTypeBizImpl">
<property name="paytypedao">
<ref local="payTypeDao"/>
</property>
</bean>
<!--
<bean id="payTypeBizProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target">
<ref local="payTypeBiz"/>
</property>
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
-->
<bean id="businessBiz" class="com.kettas.upp.background.biz.impl.BusinessBizImpl">
<property name="businessdao">
<ref local="businessDao"/>
</property>
</bean>
<!--
<bean id="businessBizProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target">
<ref local="businessBiz"/>
</property>
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
-->
<bean id="userAccountBiz" class="com.kettas.upp.background.biz.impl.UserAccountBizImpl">
<property name="userAccountDao">
<ref local="userAccountDao"/>
</property>
</bean>
<bean id="accountStreamBiz" class="com.kettas.upp.background.biz.impl.AccountStreamBizImpl">
<property name="accountStreamDao">
<ref local="accountStreamDao"/>
</property>
</bean>
<bean id="subUserAccountBiz" class="com.kettas.upp.background.biz.impl.SubUserAccountBizImpl">
<property name="subUserAccountDao">
<ref local="subUserAccountDao"/>
</property>
</bean>
<bean id="payOrderBiz" class="com.kettas.upp.background.biz.impl.PayOrderBizImpl">
<property name="payOrderDao">
<ref local="payOrderDao"/>
</property>
</bean>
<!-- interceptor -->
<bean id="interceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- auto proxy creator -->
<bean id="bizProxy"
class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>*Biz</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>interceptor</value>
</list>
</property>
</bean>
<bean name="/addBusiness,/selectBusiness,/selectToAddBusiness,/selectToDeleteBusiness,/toDeleteBusiness,/deleteBusinessSureProduct,/deleteBusinessSureBusiness,/selectToUpdateBusiness,/toUpdateBusiness,/updateBusiness,/selectBusinessByName" class="com.kettas.upp.background.action.BusinessAction">
<property name="businessBiz">
<ref local="businessBiz"/>
</property>
<property name="productBiz">
<ref local="productBiz"/>
</property>
<property name="productPayTypeBiz">
<ref local="productPayTypeBiz"/>
</property>
</bean>
<bean name="/selectBusinessForProduct,/addProduct,/selectAllProducts,/toDeleteProduct,/selectToDeleteProduct,/toDeleteAllProducts,/selectToUpdateProduct,/toUpdateProduct,/updateProduct,/toSelectProductByBusiness,/selectProductByName,/selectProductByBusiness" class="com.kettas.upp.background.action.ProductAction">
<property name="businessBiz">
<ref local="businessBiz"/>
</property>
<property name="productBiz">
<ref local="productBiz"/>
</property>
<property name="productPayTypeBiz">
<ref local="productPayTypeBiz"/>
</property>
</bean>
<bean name="/selectToAddProductPayType,/toAddProductPayType,/addProductPayType,/selectAllProductPayTypes,/selectToDeletePPT,/deletePPTById,/toDeletePPTByProduct,/deletePPTByProduct,/trueDeletePPTByProduct,/toDeletePPTByPayType,/deletePPTByPayType,/toSelectPPT,/sureSelect,/toSelectPPTByProduct,/selectPPTByProduct,/trueSelectPPTByProduct,/selectPPTByProduct,/trueSelectPPTByProduct,/selectToUpdatePPT,/toUpdatePPT,/updatePPT" class="com.kettas.upp.background.action.ProductPayTypeAction">
<property name="productPayTypeBiz">
<ref local="productPayTypeBiz"/>
</property>
<property name="productBiz">
<ref local="productBiz"/>
</property>
<property name="payTypeBiz">
<ref local="payTypeBiz"/>
</property>
<property name="businessBiz">
<ref local="businessBiz"/>
</property>
</bean>
<bean name="/addPayType,/selectAllPayTypes,/selectToUpdatePayType,/toUpdatePayType,/updatePayType,/selectToDeletePayType,/toDeletePayType,/sureDeletePT" class="com.kettas.upp.background.action.PayTypeAction">
<property name="payTypeBiz">
<ref local="payTypeBiz"/>
</property>
<property name="productPayTypeBiz">
<ref local="productPayTypeBiz"/>
</property>
</bean>
<bean name="/sendCartOrder,/registerUser,/userLogin" class="com.kettas.upp.background.buyflow.action.UserAccountAction">
<property name="userAccountBiz">
<ref local="userAccountBiz"/>
</property>
</bean>
<bean name="/findValidPayType,/toPay" class="com.kettas.upp.background.buyflow.action.PayOrderAction">
<property name="productBiz">
<ref local="productBiz"/>
</property>
<property name="productPayTypeBiz">
<ref local="productPayTypeBiz"/>
</property>
<property name="payOrderBiz">
<ref local="payOrderBiz"/>
</property>
<property name="payTypeBiz">
<ref local="payTypeBiz"/>
</property>
</bean>
<bean name="/chinaPay,/reciveResponse" class="com.kettas.upp.background.buyflow.action.AccountStreamAction">
<property name="accountStreamBiz">
<ref local="accountStreamBiz"/>
</property>
</bean>
<bean name="/bankService" class="com.kettas.upp.background.buyflow.action.BankAction">
</bean>
</beans>
1,spring与struts整合
即然用了spring,那么就该将spring与struts整合,让spring能管理struts的action。spring与struts整合总结起来只有三个地方需要注意。
a,在struts-config.xml文件中注册spring插件,如下所示。
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/springContext.xml" />
</plug-in>
b,将所有action的type都设为org.springframework.web.struts.DelegatingActionProxy。
c,在spring配置上下文applicationContext.xml中注册一个与上面action的path对应的bean。如:
<bean name="/adminLogin" class="实际action类" abstract="false" singleton="false" lazy-init="default" autowire="default" dependency-check="default"></bean>
2,dispatchaction
一个表单对应一个formbean,对应一个action类,这样当然也可以。不过我不喜欢。这次项目中所有formbean都是动态formbean。action都是继承dispatchaction。这样做好以后,每个动作都有一个方法对应。每个方法都有与excute方法一个的签名。当需要使用时,就这样指向:/admin.do?action=login。其中action参数是在struts-config.xml中设定的。
3,lookupdispatchaction与中文问题
这个与上面的基本差不多。但需要多写一个方法:getKeyMethodMap()。具体使用网络有很多文章可以查到。不过,所有的文件中,bean:message标签对应的都是英文。不知道他们是否都没有用过中文,我想对中国人来说,按钮的文字还是中文比较好些。所有我就用了中文,结果却发出,一旦使用了中文后,struts马上报错,说找不到什么的方法。真是气死我了。最后没办法,将struts的源码下来后,加入项目中一起调试跟踪,最后发现原来是页面按钮上的中文传到后台全部乱码了。这样就好办了,只要在struts中加放编码处理,设定utf-8就行了。
Struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="allForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="name" type="java.lang.String"/>
<form-property name="description" type="java.lang.String"/>
<form-property name="superBizId" type="java.lang.Integer"/>
<form-property name="businessId" type="java.lang.Integer"/>
<form-property name="superId" type="java.lang.Integer"/>
</form-bean>
</form-beans>
<global-forwards>
<forward name="error" path="/error.jsp"/>
</global-forwards>
<action-mappings>
<!-- about Business -->
<action path="/addBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="registerBusiness" name="allForm">
<forward name="ok" path="/selectBusiness.do" redirect="true"/>
</action>
<action path="/selectBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="findAllBusiness" name="allForm">
<forward name="ok" path="/showAllBusiness.jsp"/>
</action>
<action path="/selectBusinessByName" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectBusinessByName" name="allForm">
<forward name="ok" path="/showOneBusiness.jsp"/>
</action>
<action path="/toUpdateBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toUpdateBusiness" name="allForm">
<forward name="ok" path="/updateBusiness.jsp"/>
</action>
<action path="/updateBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="updateBusiness" name="allForm">
<forward name="ok" path="/selectBusiness.do"/>
</action>
<action path="/selectToAddBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="findAllBusiness">
<forward name="ok" path="/registerBusiness.jsp"/>
</action>
<action path="/selectToDeleteBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="findAllBusiness">
<forward name="ok" path="/deleteBusiness.jsp"/>
</action>
<action path="/selectToUpdateBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="findAllBusiness">
<forward name="ok" path="/toUpdateBusiness.jsp"/>
</action>
<action path="/toDeleteBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toDeleteBusiness" name="allForm">
<forward name="ok" path="/selectBusiness.do" redirect="true"/>
<forward name="hasProduct" path="/sureDeleteBusiness_product.jsp"/>
<forward name="hasBusiness" path="/sureDeleteBusiness_biz.jsp" />
</action>
<action path="/deleteBusinessSureProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="deleteBusinessSureProduct">
<forward name="ok" path="/selectBusiness.do" redirect="true"/>
</action>
<action path="/deleteBusinessSureBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="deleteBusinessSureBusiness" name="allForm">
<forward name="ok" path="/selectBusiness.do"/>
<forward name="hasProduct" path="/sureDeleteBusiness_product.jsp"/>
</action>
<!-- about Product -->
<action path="/selectBusinessForProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="findAllBusiness" name="allForm">
<forward name="ok" path="/addProduct.jsp"/>
</action>
<action path="/addProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="addProduct">
<forward name="ok" path="/selectAllProducts.do"/>
</action>
<action path="/selectAllProducts" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectAllProducts">
<forward name="ok" path="/showAllProducts.jsp"/>
</action>
<action path="/selectToDeleteProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectAllProducts">
<forward name="ok" path="/deleteProduct.jsp"/>
</action>
<action path="/toDeleteProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toDeleteProduct">
<forward name="ok" path="/selectAllProducts.do"/>
<forward name="haveProductPayType" path="/sureDeleteProduct.jsp"/>
</action>
<action path="/toDeleteAllProducts" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toDeleteAllProducts">
<forward name="ok" path="/success.jsp"/>
</action>
<action path="/selectToUpdateProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectAllProducts">
<forward name="ok" path="/toUpdateProduct.jsp"/>
</action>
<action path="/toUpdateProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toUpdateProduct">
<forward name="ok" path="/updateProduct.jsp"/>
</action>
<action path="/updateProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="updateProduct">
<forward name="ok" path="/selectAllProducts.do"/>
</action>
<action path="/toSelectProductByBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toSelectProductByBusiness">
<forward name="ok" path="/selectProductByBusiness.jsp"/>
</action>
<action path="/selectProductByBusiness" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectProductByBusiness">
<forward name="ok" path="/showSomeProducts.jsp"/>
</action>
<action path="/selectProductByName" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectProductByName">
<forward name="ok" path="/showSomeProducts.jsp"/>
</action>
<!-- about ProductPayType -->
<action path="/selectToAddProductPayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectToAddProductPayType">
<forward name="ok" path="/toAddProductPayType.jsp"/>
</action>
<action path="/toAddProductPayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toAddProductPayType">
<forward name="ok" path="/addProductPayType.jsp"/>
</action>
<action path="/addProductPayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="addProductPayType">
<forward name="ok" path="/selectAllProductPayTypes.do"/>
</action>
<action path="/selectAllProductPayTypes" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectAllProductPayTypes">
<forward name="ok" path="/showAllProductPayTypes.jsp"/>
</action>
<action path="/selectToDeletePPT" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectToDeletePPT">
<forward name="ok" path="/toDeletePPT.jsp"/>
</action>
<action path="/deletePPTById" type="org.springframework.web.struts.DelegatingActionProxy" parameter="deletePPTById">
<forward name="ok" path="/selectAllProductPayTypes.do"/>
</action>
<action path="/toDeletePPTByProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toDeletePPTByProduct">
<forward name="ok" path="/toDeletePPTByProduct.jsp"/>
</action>
<action path="/deletePPTByProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="deletePPTByProduct">
<forward name="ok" path="/deletePPTByProduct.jsp"/>
</action>
<action path="/trueDeletePPTByProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="trueDeletePPTByProduct">
<forward name="ok" path="/selectAllProductPayTypes.do"/>
</action>
<action path="/selectToUpdatePPT" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectToUpdatePPT">
<forward name="ok" path="/toUpdatePPT.jsp"/>
</action>
<action path="/toUpdatePPT" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toUpdatePPT">
<forward name="ok" path="/updatePPT.jsp"/>
</action>
<action path="/updatePPT" type="org.springframework.web.struts.DelegatingActionProxy" parameter="updatePPT">
<forward name="ok" path="/selectAllProductPayTypes.do"/>
</action>
<action path="/toDeletePPTByPayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toDeletePPTByPayType">
<forward name="ok" path="/deletePPTByPayType.jsp"/>
</action>
<action path="/deletePPTByPayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="deletePPTByPayType">
<forward name="ok" path="/selectAllProductPayTypes.do"/>
</action>
<action path="/toSelectPPTByProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toSelectPPTByProduct">
<forward name="ok" path="/toSelectPPTByProduct.jsp"/>
</action>
<action path="/sureSelect" type="org.springframework.web.struts.DelegatingActionProxy" parameter="sureSelect">
<forward name="ok" path="/showSomeProductPayTypes.jsp"/>
</action>
<action path="/selectPPTByProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectPPTByProduct">
<forward name="ok" path="/trueSelectPPTByProduct.jsp"/>
</action>
<action path="/trueSelectPPTByProduct" type="org.springframework.web.struts.DelegatingActionProxy" parameter="trueSelectPPTByProduct">
<forward name="ok" path="/showSomeProductPayTypes.jsp"/>
</action>
<action path="/toSelectPPT" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toSelectPPT">
<forward name="ok" path="/toSelectPPT.jsp"/>
</action>
<!-- about PayType -->
<action path="/addPayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="addPayType">
<forward name="ok" path="/selectAllPayTypes.do"/>
</action>
<action path="/selectAllPayTypes" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectAllPayTypes">
<forward name="ok" path="/showAllPayTypes.jsp"/>
</action>
<action path="/selectToUpdatePayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectAllPayTypes">
<forward name="ok" path="/toUpdatePayType.jsp"/>
</action>
<action path="/toUpdatePayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toUpdatePayType">
<forward name="ok" path="/updatePayType.jsp"/>
</action>
<action path="/updatePayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="updatePayType">
<forward name="ok" path="/selectAllPayTypes.do"/>
</action>
<action path="/selectToDeletePayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="selectAllPayTypes">
<forward name="ok" path="/toDeletePayType.jsp"/>
</action>
<action path="/toDeletePayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toDeletePayType">
<forward name="ok" path="/selectAllPayTypes.do"/>
<forward name="havePPT" path="/sureDeletePayType.jsp"/>
</action>
<action path="/sureDeletePT" type="org.springframework.web.struts.DelegatingActionProxy" parameter="sureDeletePT">
<forward name="ok" path="/selectAllPayTypes.do"/>
</action>
<!-- about BuyFlow -->
<action path="/sendCartOrder" type="org.springframework.web.struts.DelegatingActionProxy" parameter="recieveOrder">
<forward name="ok" path="/bfpages/userLogin.jsp"/>
</action>
<action path="/userLogin" type="org.springframework.web.struts.DelegatingActionProxy" parameter="userLogin">
<forward name="ok" path="/findValidPayType.do"/>
</action>
<action path="/registerUser" type="org.springframework.web.struts.DelegatingActionProxy" parameter="registerUser">
<forward name="ok" path="/findValidPayType.do"/>
</action>
<action path="/findValidPayType" type="org.springframework.web.struts.DelegatingActionProxy" parameter="findValidPayType">
<forward name="ok" path="/bfpages/showValidPayTypes.jsp"/>
</action>
<action path="/toPay" type="org.springframework.web.struts.DelegatingActionProxy" parameter="toPay">
<forward name="ok" path="/bfpages/surePay.jsp"/>
</action>
<action path="/chinaPay" type="org.springframework.web.struts.DelegatingActionProxy" parameter="chinaPay">
<forward name="ok" path="/bankService.do"/>
</action>
<action path="/bankService" type="org.springframework.web.struts.DelegatingActionProxy" parameter="bankService">
<forward name="ok" path="/reciveResponse.do"/>
</action>
<action path="/reciveResponse" type="org.springframework.web.struts.DelegatingActionProxy" parameter="reciveResponse">
<forward name="ok" path="/bfpages/getResponse.jsp"/>
</action>
</action-mappings>
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml"/>
</plug-in>
</struts-config>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>
com.my.web.SysListener
</listener-class>
</listener>
<filter>
<filter-name>encoding</filter-name>
<filter-class>com.kettas.upp.background.util.EncodingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
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.0.xsd">
<!-- Golobal -->
<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:@127.0.0.1:1521:XE">
</property>
<property name="username">
<value>haofeng</value>
</property>
<property name="password">
<value>haofeng</value>
</property>
<property name="maxActive">
<value>10</value>
</property>
<property name="maxIdle">
<value>3</value>
</property>
<property name="minIdle">
<value>1</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="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>
<property name="mappingResources">
<list>
<value>com/kettas/upp/background/entity/PayType.hbm.xml</value>
<value>com/kettas/upp/background/entity/Product.hbm.xml</value>
<value>com/kettas/upp/background/entity/Business.hbm.xml</value>
<value>com/kettas/upp/background/entity/ProductPayType.hbm.xml</value>
<value>com/kettas/upp/background/entity/PayOrder.hbm.xml</value>
<value>com/kettas/upp/background/entity/UserAccount.hbm.xml</value>
<value>com/kettas/upp/background/entity/SubUserAccount.hbm.xml</value>
<value>com/kettas/upp/background/entity/AccountStream.hbm.xml</value>
</list>
</property>
</bean>
<!--
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
-->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="businessDao" class="com.kettas.upp.background.dao.impl.BusinessDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="payTypeDao" class="com.kettas.upp.background.dao.impl.PayTypeDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="productDao" class="com.kettas.upp.background.dao.impl.ProductDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="productPayTypeDao" class="com.kettas.upp.background.dao.impl.ProductPayTypeDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="userAccountDao" class="com.kettas.upp.background.dao.impl.UserAccountDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="subUserAccountDao" class="com.kettas.upp.background.dao.impl.SubUserAccountDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="accountStreamDao" class="com.kettas.upp.background.dao.impl.AccountStreamDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="payOrderDao" class="com.kettas.upp.background.dao.impl.PayOrderDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="productBiz" class="com.kettas.upp.background.biz.impl.ProductBizImpl">
<property name="productdao">
<ref local="productDao"/>
</property>
</bean>
<!--
<bean id="productBizProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target">
<ref local="productBiz"/>
</property>
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
-->
<bean id="productPayTypeBiz" class="com.kettas.upp.background.biz.impl.ProductPayTypeBizImpl">
<property name="productpaytypedao">
<ref local="productPayTypeDao"/>
</property>
</bean>
<!--
<bean id="productPayTypeBizProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target">
<ref local="productPayTypeBiz"/>
</property>
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
-->
<bean id="payTypeBiz" class="com.kettas.upp.background.biz.impl.PayTypeBizImpl">
<property name="paytypedao">
<ref local="payTypeDao"/>
</property>
</bean>
<!--
<bean id="payTypeBizProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target">
<ref local="payTypeBiz"/>
</property>
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
-->
<bean id="businessBiz" class="com.kettas.upp.background.biz.impl.BusinessBizImpl">
<property name="businessdao">
<ref local="businessDao"/>
</property>
</bean>
<!--
<bean id="businessBizProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target">
<ref local="businessBiz"/>
</property>
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
-->
<bean id="userAccountBiz" class="com.kettas.upp.background.biz.impl.UserAccountBizImpl">
<property name="userAccountDao">
<ref local="userAccountDao"/>
</property>
</bean>
<bean id="accountStreamBiz" class="com.kettas.upp.background.biz.impl.AccountStreamBizImpl">
<property name="accountStreamDao">
<ref local="accountStreamDao"/>
</property>
</bean>
<bean id="subUserAccountBiz" class="com.kettas.upp.background.biz.impl.SubUserAccountBizImpl">
<property name="subUserAccountDao">
<ref local="subUserAccountDao"/>
</property>
</bean>
<bean id="payOrderBiz" class="com.kettas.upp.background.biz.impl.PayOrderBizImpl">
<property name="payOrderDao">
<ref local="payOrderDao"/>
</property>
</bean>
<!-- interceptor -->
<bean id="interceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager">
<ref local="transactionManager"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- auto proxy creator -->
<bean id="bizProxy"
class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>*Biz</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>interceptor</value>
</list>
</property>
</bean>
<bean name="/addBusiness,/selectBusiness,/selectToAddBusiness,/selectToDeleteBusiness,/toDeleteBusiness,/deleteBusinessSureProduct,/deleteBusinessSureBusiness,/selectToUpdateBusiness,/toUpdateBusiness,/updateBusiness,/selectBusinessByName" class="com.kettas.upp.background.action.BusinessAction">
<property name="businessBiz">
<ref local="businessBiz"/>
</property>
<property name="productBiz">
<ref local="productBiz"/>
</property>
<property name="productPayTypeBiz">
<ref local="productPayTypeBiz"/>
</property>
</bean>
<bean name="/selectBusinessForProduct,/addProduct,/selectAllProducts,/toDeleteProduct,/selectToDeleteProduct,/toDeleteAllProducts,/selectToUpdateProduct,/toUpdateProduct,/updateProduct,/toSelectProductByBusiness,/selectProductByName,/selectProductByBusiness" class="com.kettas.upp.background.action.ProductAction">
<property name="businessBiz">
<ref local="businessBiz"/>
</property>
<property name="productBiz">
<ref local="productBiz"/>
</property>
<property name="productPayTypeBiz">
<ref local="productPayTypeBiz"/>
</property>
</bean>
<bean name="/selectToAddProductPayType,/toAddProductPayType,/addProductPayType,/selectAllProductPayTypes,/selectToDeletePPT,/deletePPTById,/toDeletePPTByProduct,/deletePPTByProduct,/trueDeletePPTByProduct,/toDeletePPTByPayType,/deletePPTByPayType,/toSelectPPT,/sureSelect,/toSelectPPTByProduct,/selectPPTByProduct,/trueSelectPPTByProduct,/selectPPTByProduct,/trueSelectPPTByProduct,/selectToUpdatePPT,/toUpdatePPT,/updatePPT" class="com.kettas.upp.background.action.ProductPayTypeAction">
<property name="productPayTypeBiz">
<ref local="productPayTypeBiz"/>
</property>
<property name="productBiz">
<ref local="productBiz"/>
</property>
<property name="payTypeBiz">
<ref local="payTypeBiz"/>
</property>
<property name="businessBiz">
<ref local="businessBiz"/>
</property>
</bean>
<bean name="/addPayType,/selectAllPayTypes,/selectToUpdatePayType,/toUpdatePayType,/updatePayType,/selectToDeletePayType,/toDeletePayType,/sureDeletePT" class="com.kettas.upp.background.action.PayTypeAction">
<property name="payTypeBiz">
<ref local="payTypeBiz"/>
</property>
<property name="productPayTypeBiz">
<ref local="productPayTypeBiz"/>
</property>
</bean>
<bean name="/sendCartOrder,/registerUser,/userLogin" class="com.kettas.upp.background.buyflow.action.UserAccountAction">
<property name="userAccountBiz">
<ref local="userAccountBiz"/>
</property>
</bean>
<bean name="/findValidPayType,/toPay" class="com.kettas.upp.background.buyflow.action.PayOrderAction">
<property name="productBiz">
<ref local="productBiz"/>
</property>
<property name="productPayTypeBiz">
<ref local="productPayTypeBiz"/>
</property>
<property name="payOrderBiz">
<ref local="payOrderBiz"/>
</property>
<property name="payTypeBiz">
<ref local="payTypeBiz"/>
</property>
</bean>
<bean name="/chinaPay,/reciveResponse" class="com.kettas.upp.background.buyflow.action.AccountStreamAction">
<property name="accountStreamBiz">
<ref local="accountStreamBiz"/>
</property>
</bean>
<bean name="/bankService" class="com.kettas.upp.background.buyflow.action.BankAction">
</bean>
</beans>
1,spring与struts整合
即然用了spring,那么就该将spring与struts整合,让spring能管理struts的action。spring与struts整合总结起来只有三个地方需要注意。
a,在struts-config.xml文件中注册spring插件,如下所示。
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/springContext.xml" />
</plug-in>
b,将所有action的type都设为org.springframework.web.struts.DelegatingActionProxy。
c,在spring配置上下文applicationContext.xml中注册一个与上面action的path对应的bean。如:
<bean name="/adminLogin" class="实际action类" abstract="false" singleton="false" lazy-init="default" autowire="default" dependency-check="default"></bean>
2,dispatchaction
一个表单对应一个formbean,对应一个action类,这样当然也可以。不过我不喜欢。这次项目中所有formbean都是动态formbean。action都是继承dispatchaction。这样做好以后,每个动作都有一个方法对应。每个方法都有与excute方法一个的签名。当需要使用时,就这样指向:/admin.do?action=login。其中action参数是在struts-config.xml中设定的。
3,lookupdispatchaction与中文问题
这个与上面的基本差不多。但需要多写一个方法:getKeyMethodMap()。具体使用网络有很多文章可以查到。不过,所有的文件中,bean:message标签对应的都是英文。不知道他们是否都没有用过中文,我想对中国人来说,按钮的文字还是中文比较好些。所有我就用了中文,结果却发出,一旦使用了中文后,struts马上报错,说找不到什么的方法。真是气死我了。最后没办法,将struts的源码下来后,加入项目中一起调试跟踪,最后发现原来是页面按钮上的中文传到后台全部乱码了。这样就好办了,只要在struts中加放编码处理,设定utf-8就行了。
发表评论
文章已被作者锁定,不允许评论。
-
DelegatingActionProxy
2009-08-21 10:11 1012struts 中使用.DelegatingActionProx ... -
写一个监听去初始化Spring管理的bean
2009-08-21 09:01 1724写一个监听去初始化Spring管理的bean packag ... -
SSH整合
2009-08-14 11:51 5924Struts+hibernate+Spring的整 ... -
servlet中获取spring的WebApplicationContext
2009-08-14 11:43 2039SSH 整合中的监听器的问题 在做项目时,由于有一部分数据 ... -
spring struts如何整合
2009-08-11 13:50 1244为了在Struts中加载Spring context,需要在s ...
相关推荐
"ConfigFile"这个标题暗示我们将探讨配置文件的使用和实践。配置文件通常采用特定格式(如XML、JSON、YAML或ini),用于存储可定制的设置,这些设置可以根据用户需求或环境条件进行更改,而无需修改源代码。 配置...
该程序可以提取由于授权问题影响的多款Hikvision产品的configfile文件中的管理员账号密码。具体影响产品型号,请参考CVE-2017-7921;CVE-2017-7922漏洞详情。该程序发布,意在警醒相关单位及时更新相关设备,网络...
grub config file
nginx config file xiangxishuoming
标题中的"ReadConfigFile.rar"表明这是一个压缩文件,通常用于存储多个相关文件。在这个场景下,我们可以假设这个压缩包包含了与读取配置文件相关的代码、文档或者示例。配置文件在IT领域中扮演着重要角色,它们存储...
标题 "SW_ConfigFILE.zip" 暗示这是一个包含软件配置文件的压缩包,可能是用于某个软件或系统的配置设定。从描述中我们并没有获得更多的信息,但我们可以根据压缩包内的文件名称来推测其可能包含的内容。 1. **pip*...
"config file parser"就是一种工具,用于解析和写入这类文件。本篇将详细探讨配置文件、其常见格式(如INI)、以及如何实现一个简单的配置文件读写类。 配置文件通常用于储存应用的个性化设定,比如数据库连接字符...
redhat 64bit 3.4.0kernel 的配置文件,已经打开了Xen的虚拟化支持
OPENWRT config file ipq807x,测试可以编译完成的,备份以备自己直接覆盖.config不用再make menuconfig 使用
"RunProgresser-1.0_runprogresser_ME_batch_configfile_" 是一个软件包,由用户“me”和团队“TheBATeam”共同开发的RunProgresser 10版本。这个压缩包主要是为了备份目的而存档的。从标签“runprogresser”,“ME...
为此,"log4net config file editor"应运而生。 这个工具提供了一个用户友好的界面,使得开发者可以直观地设定所需的log4net配置。通过这个GUI工具,用户可以: 1. **选择日志适配器**:log4net支持多种日志适配器...
配置文件 configfile是一个命令行工具,可帮助用户管理自己的配置文件。...configfile init或configfile i :在当前用户会话上初始化configfile 。 -f, --force force强制覆盖当前配置。 configfile mod
1695194911208071_configFile.mobileconfig
"Leap Config File" 是一个与 Leap Motion 控制器相关的配置文件。Leap Motion 是一款先进的手势控制设备,能够让用户通过手部动作来操控电脑或应用程序,为用户提供无触碰的交互体验。这款技术广泛应用于游戏、设计...
jenkins插件config-file-provider最新版,安装nodejs插件必须要使用这个插件作为支持
download this file and put it in /etc/xinetd.d/. at the same time create a directory /tftpboot and make it has 777 properties.
在使用MySQL数据库时,我们可能会遇到这样一个问题:尝试重启MySQL服务时,系统返回"Warning: World-writable config file '/etc/my.cnf' is ignored"的错误提示,这意味着MySQL配置文件`my.cnf`的权限设置不正确,...
FIREWALL CONFIGFILE FIREWALL CONFIGFILE
资源分类:Python库 所属语言:Python 资源全名:configfile-1.2.2-py2.py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059