`
haofenglemon
  • 浏览: 241549 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

config file

    博客分类:
  • ssh
阅读更多
配置文件的书写

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就行了。


分享到:
评论
发表评论

文章已被作者锁定,不允许评论。

相关推荐

Global site tag (gtag.js) - Google Analytics