ITPub博客

首页 > Linux操作系统 > Linux操作系统 > struts和spring的配置实例

struts和spring的配置实例

原创 Linux操作系统 作者:cppsoldier 时间:2008-10-19 12:06:36 0 删除 编辑

1.web.xml


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">
 
  action
  
   org.apache.struts.action.ActionServlet
  

  
   config
   /WEB-INF/struts-config.xml
  

  
   debug
   3
  

  
   detail
   3
  

  0
 

 
  action
  *.do
 

 
  
  action_tmp
  
   org.apache.struts.action.ActionServlet
  

  
   config
   /WEB-INF/struts-config.xml
  

  
   debug
   3
  

  
   detail
   3
  

  0
 

<!-- 对会员进行过滤 --> 

 <!--
  
   This is the description of my J2EE component
  

  
   This is the display name of my J2EE component
  

  UsernameValidate
  
   com.hb.shop.servlet.UsernameValidate
  

 

 -->
 <!--
  UsernameValidate
  /UsernameValidate
 

 


 -->
<!-- 
  Kaptcha
  
   com.google.code.kaptcha.servlet.KaptchaServlet
  

 

 
  Kaptcha
  /kaptcha.jpg
 

-->
<!-- 对会员进行登陆过滤(ypf) -->

 
<!--  
  userLoginFilter
  
   com.hb.shop.help.userLoginFilter
  

 

 
  userLoginFilter
  /index.jsp
 

 -->
<!-- 对会员进行登陆过滤(ypf) --> 

 
  
  testAction
  
   com.hb.shop.web.form.SetEncodingActionServlet
  

  
   config
   /WEB-INF/struts-config.xml
  

  
   encoding
   utf-8
  

  2
 

 
  testAction
  *.do
 

 

 
  ViewCheckFilter
  
   com.hb.shop.web.action.ViewCheckFilter
  

 

 
  ViewCheckFilter
  /jsp/admin/addGoods.jsp
 

 
  ViewCheckFilter
  /jsp/admin/addType.jsp
 

 
  ViewCheckFilter
  /jsp/admin/adminBody.jsp
 

 
  ViewCheckFilter
  /jsp/admin/adminIndex.jsp
 

 
  ViewCheckFilter
  /jsp/admin/adminLeft.jsp
 

 
  ViewCheckFilter
  /jsp/admin/adminLow.jsp
 

 
  ViewCheckFilter
  /jsp/admin/adminMain.jsp
 

 
  ViewCheckFilter
  /jsp/admin/adminTop.jsp
 

 
  ViewCheckFilter
  /jsp/admin/completeOrders.jsp
 

 
  ViewCheckFilter
  /jsp/admin/editGoods.jsp
 

 
  ViewCheckFilter
  /jsp/admin/editOrder.jsp
 

 
  ViewCheckFilter
  /jsp/admin/editOrderList.jsp
 

 
  ViewCheckFilter
  /jsp/admin/editType.jsp
 

 
  ViewCheckFilter
  /jsp/admin/listAllGoods.jsp
 

 
  ViewCheckFilter
  /jsp/admin/listAllTypes.jsp
 

 
  ViewCheckFilter
  /jsp/admin/orderInfo.jsp
 

 
 
 
 
 
 
 
 
 
 
  userLoginFilter
  
   com.hb.shop.tool.userLoginFilter
  

 

 
  userLoginFilter
  /balance.jsp
 

 
  userLoginFilter
  /buy2.jsp
 

 
  userLoginFilter
  /check.jsp
 

 
 
  userLoginFilter
  /member/*
 

2.struts-config.xml


http://struts.apache.org/dtds/struts-config_1_2.dtd">


 
 
     type="com.hb.shop.web.form.AdminLoginForm" />
     type="com.hb.shop.web.form.AddTypeForm" />
     type="com.hb.shop.web.form.MemRegisterForm" />
     type="com.hb.shop.web.form.MemLoginForm" />
     type="com.hb.shop.web.form.ValidateForm" />
     type="com.hb.shop.web.form.AddGoodsForm" />
   
     
     
     
     
   

   
     
     
     
   

   
     
     
     
     
     
     
     
   

   
     
     
   

   
     
     
     
     
     
     
     
   

   
     
     
     
   

   
     
     
     
   

   
   
   
   
  
    

 
 
     redirect="true" />
     redirect="true" />
     redirect="true" />
     redirect="true" />
     redirect="true" />
     path="/simplecaptchaError.jsp" />

 

 

  <!-- cy -->
  <!--   type="org.springframework.web.struts.DelegatingActionProxy">
   
  

  -->
     input="/jsp/admin/adminLogin.html" name="adminLoginForm"
   path="/adminLogin" scope="request"
   type="org.springframework.web.struts.DelegatingActionProxy">
   
   
  

     input="/jsp/admin/goods/addType.jsp" name="addTypeForm"
   path="/addType" scope="request"
   type="org.springframework.web.struts.DelegatingActionProxy">
       redirect="true">
   

       redirect="true">
   

  

     name="addTypeForm" scope="request" parameter="method"
   type="org.springframework.web.struts.DelegatingActionProxy">
       path="/jsp/admin/listAllTypes.jsp">
   

   
   
  

     name="addGoodsForm" scope="request" parameter="method"
   type="org.springframework.web.struts.DelegatingActionProxy">
   
   
   
   
  

  
     type="org.springframework.web.struts.DelegatingActionProxy">
   
  

  
     type="org.springframework.web.struts.DelegatingActionProxy">
   
  

  
     type="org.springframework.web.struts.DelegatingActionProxy">
   
   
   
   
  

  
     type="org.springframework.web.struts.DelegatingActionProxy">
   
   
   
   
   
  

  <!-- cy -->

  <!-- ypf -->
     name="memRegisterForm" path="/memRegister" scope="request"
   type="org.springframework.web.struts.DelegatingActionProxy" />
     name="memLoginForm" path="/memLogin" scope="request"
   type="org.springframework.web.struts.DelegatingActionProxy"
   validate="false" />
     name="validateForm" path="/validate" scope="request"
   type="com.hb.shop.web.action.ValidateAction" validate="false" />
          attribute="regForm"
      input="/reg.jsp"
      name="regForm"
      path="/reg"
      scope="request"
      type="org.springframework.web.struts.DelegatingActionProxy" />
          attribute="loginForm"
      input="/login.jsp"
      name="loginForm"
      path="/login"
      scope="request"
      type="org.springframework.web.struts.DelegatingActionProxy" />
   
   
          path="/add"
     parameter="add"
     type="org.springframework.web.struts.DelegatingActionProxy" />
           path="/delete"
     parameter="delete"
     type="org.springframework.web.struts.DelegatingActionProxy" />
 
         path="/addNum"
     parameter="addNum"
     type="org.springframework.web.struts.DelegatingActionProxy" />
           path="/reduceNum"
     parameter="reduceNum"
     type="org.springframework.web.struts.DelegatingActionProxy" />
   
   
   
          attribute="deliverAddressInfoForm"
      input="balance.jsp"
      name="deliverAddressInfoForm"
      path="/deliverAddressInfo"
      scope="request"
      type="org.springframework.web.struts.DelegatingActionProxy" />
          attribute="submitOrderForm"
      input="/balance.jsp"
      name="submitOrderForm"
      path="/submitOrder"
      scope="request"
      type="org.springframework.web.struts.DelegatingActionProxy" />
          attribute="memberInfoForm"
      input="/member/editMyInfo.jsp"
      name="memberInfoForm"
      path="/memberInfo"
      scope="request"
      type="org.springframework.web.struts.DelegatingActionProxy" />
          attribute="emailInfoForm"
      input="/member/emailEdit.jsp"
      name="emailInfoForm"
      path="/emailInfo"
      scope="request"
      type="org.springframework.web.struts.DelegatingActionProxy" />
          attribute="nameInfoForm"
      input="/member/nameEdit.jsp"
      name="nameInfoForm"
      path="/nameInfo"
      scope="request"
      type="org.springframework.web.struts.DelegatingActionProxy" />
          attribute="passwordInfoForm"
      input="/member/passwordEdit.jsp"
      name="passwordInfoForm"
      path="/passwordInfo"
      scope="request"
      type="com.hb.shop.web.action.PasswordInfoAction" />
          attribute="testForm"
      input="/test.jsp"
      name="testForm"
      path="/test"
      scope="request"
      type="shop.web.action.TestAction" />

  
  <!-- ypf -->

 

 

   className="org.springframework.web.struts.ContextLoaderPlugIn">
     property="contextConfigLocation" />
 
 
    value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
  
 




3.spring配置文件:applicationContext.xml


http://www.springframework.org/dtd/spring-beans.dtd">


 <!--注入BEAN-->
 

   class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  
   
  

  
   
    com/hb/shop/modules/Admin.hbm.xml
    com/hb/shop/modules/Stocks.hbm.xml
    com/hb/shop/modules/Member.hbm.xml
    com/hb/shop/modules/Type.hbm.xml
    com/hb/shop/modules/Buyer.hbm.xml
    com/hb/shop/modules/Shoppinglist.hbm.xml
    com/hb/shop/modules/Goods.hbm.xml
    com/hb/shop/modules/Shoporder.hbm.xml
   

  

  
   
    
     org.hibernate.dialect.Oracle9Dialect
    

   

  

 
   class="org.apache.commons.dbcp.BasicDataSource">
  
   oracle.jdbc.driver.OracleDriver
  

  
   jdbc:oracle:thin:@192.168.122.184:1521:orcl
  

  
   pet
  

  
   pet
  

 

 <!-- cy -->
   class="com.hb.shop.web.action.AdminLoginAction">
  
   
  

 

   class="com.hb.shop.web.action.AddTypeAction">
  
   
  

 

   class="com.hb.shop.web.action.EditTypeAction">
  
   
  

 


   class="com.hb.shop.web.action.AddGoodsAction">
  
   
  

  
   
  

 

   class="com.hb.shop.web.action.ListGoodsByTypeAction">
  
   
  

 

 
   class="com.hb.shop.web.action.LookGoodsAction">
  
   
  

 

   class="com.hb.shop.web.action.DealOrderAction">
  
   
  

  
   
  

 

 
   class="com.hb.shop.web.action.DealMemberAction">
  
   
  

 

 <!-- cy -->

 <!-- ypf -->

 <!--   class="com.hb.shop.web.action.MemRegisterAction" abstract="false"
  singleton="true" lazy-init="default" autowire="default"
  dependency-check="default">
  
  
  

  

 -->
   abstract="false" singleton="true" lazy-init="default"
  autowire="default" dependency-check="default">
  
   
  

 

   class="com.hb.shop.web.action.LoginAction" abstract="false"
  singleton="true" lazy-init="default" autowire="default"
  dependency-check="default">
  
   
  

 

   class="com.hb.shop.web.action.MemLoginAction" abstract="false"
  singleton="true" lazy-init="default" autowire="default"
  dependency-check="default">
  
   
  

 

 <!--ypf-->
   abstract="false" singleton="true" lazy-init="default"
  autowire="default" dependency-check="default">
  
   
  

 

<!-- /nameInfo  com.hb.shop.web.action.NameInfoAction-->
  abstract="false" singleton="true" lazy-init="default"
  autowire="default" dependency-check="default">
  
   
  


  abstract="false" singleton="true" lazy-init="default"
  autowire="default" dependency-check="default">
  
   
  


     abstract="false" singleton="true" lazy-init="default"
  autowire="default" dependency-check="default">
  
   
  

 

   abstract="false" singleton="true" lazy-init="default"
  autowire="default" dependency-check="default">
  
   
  

  
   
  

 

   abstract="false" singleton="true" lazy-init="default"
  autowire="default" dependency-check="default">
  
   
  

 

   abstract="false" singleton="true" lazy-init="default"
  autowire="default" dependency-check="default">
  
   
  

 

   abstract="false" singleton="true" lazy-init="default"
  autowire="default" dependency-check="default">
  
   
  

 

   abstract="false" singleton="true" lazy-init="default"
  autowire="default" dependency-check="default">
  
   
  

 

   abstract="false" singleton="true" lazy-init="default"
  autowire="default" dependency-check="default">
  
   
  

 

 
 
   class="com.hb.shop.web.action.DeliverAddressInfoAction"
  abstract="false" singleton="true" lazy-init="default"
  autowire="default" dependency-check="default">
  
   
  

 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9474419/viewspace-473075/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: Hanoi递归实现
请登录后发表评论 登录
全部评论

注册时间:2008-10-09

  • 博文量
    18
  • 访问量
    16448