1. 程式人生 > >struts.xml配置檔案小結

struts.xml配置檔案小結

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
 <constant name="struts.objectFactory" value="spring" />
 <!--<include file="struts-default.xml"></include> -->
 <constant name="struts.i18n.encoding" value="UTF-8" />
 <constant name="struts.multipart.maxSize" value="20971520"></constant>
 <package name="user" extends="struts-default">
  <!-- ***************************************自定義攔截器*************************************** -->
  <!-- 定義全部攔截器,所有攔截器和攔截器棧都在該元素下定義 -->
  <interceptors>
   <!-- 定義許可權驗證攔截器,interceptor是定義攔截器 -->
   <interceptor name="myinterceptor" class="crm.interceptor.MyInterceptor">
   </interceptor>
   <!-- 定義攔截器棧,配置了2個攔截器,interceptor-ref是配置攔截器 -->
   <interceptor-stack name="mystacks">
    <interceptor-ref name="myinterceptor" />
    <interceptor-ref name="defaultStack" />
   </interceptor-stack>
  </interceptors>

  <!-- **************************************配置預設攔截器************************************** -->
  <!-- 如果包中沒有顯示指定攔截器,則預設的攔截器會起作用, 如果包中 有其他的攔截器,則預設的攔截器不起作用,需要手動去配置攔截器的引用,每個包中只能配置一個預設的攔截器 -->
  <default-interceptor-ref name="mystacks">
  </default-interceptor-ref>

  <!-- ************************************配置全域性的result************************************* -->
  <global-results>
   <result name="login">/jsp/login.jsp</result>
   <result name="error">/jsp/error.jsp</result>
   <result name="input">/jsp/error.jsp</result>
  </global-results>

  <!-- *****************************************登入***************************************** -->
  <!-- 資訊管理之驗證登陸 -->
  <action name="login" class="LoginAction" method="login">
   <result type="redirect">/index.action</result>
   <!-- 使用系統預設的攔截器 -->
   <interceptor-ref name="defaultStack" />
  </action>
  <!-- 登入成功進入主頁面 -->
  <action name="index">
   <result>/jsp/main/main.jsp</result>
  </action>
  <!-- 判斷是否已經登入 -->
  <action name="isLogin" class="LoginAction" method="isLogin">
   <result name="json" />
   <!-- 使用系統預設的攔截器 -->
   <interceptor-ref name="defaultStack" />
  </action>
  <!-- 獲取當前使用者資訊 -->
  <action name="getCurrentUser" class="LoginAction" method="getCurrentUser">
   <result name="json" />
  </action>
  <!-- 通過角色查詢許可權選單 -->
  <action name="queryMenuThreeByRole" class="LoginAction"
   method="queryMenuThreeByRole">
   <result name="json" />
  </action>
  <!-- 修改當前使用者密碼 -->
  <action name="updateSelfPwd" class="LoginAction" method="updateSelfPwd">
   <result name="json" />
  </action>
  <!-- 退出系統 -->
  <action name="loginOut" class="LoginAction" method="loginOut">
   <result name="json" />
   <interceptor-ref name="defaultStack" />
  </action>

  <!-- ****************************************營銷管理**************************************** -->
  <!-- ********************銷售機會******************** -->
  <!-- 查詢所有使用者資訊列表 -->
  <action name="queryWorkerList" class="MarketChanceAction"
   method="queryWorkerList">
   <result name="json" />
  </action>
  <!-- 查詢營銷管理列表 -->
  <action name="queryMarketChanceByPage" class="MarketChanceAction"
   method="queryMarketChanceByPage">
   <result name="json" />
  </action>
  <!-- 新建或編輯營銷管理 -->
  <action name="addOrUpdateOneMarketChance" class="MarketChanceAction"
   method="addOrUpdateOneMarketChance">
   <result name="json" />
  </action>
  <!-- 根據id查詢營銷管理 -->
  <action name="queryMarketChanceById" class="MarketChanceAction"
   method="queryMarketChanceById">
   <result name="json" />
  </action>
  <!-- 刪除營銷管理 -->
  <action name="deleteOneMarketChance" class="MarketChanceAction"
   method="deleteOneMarketChance">
   <result name="json" />
  </action>
  <!-- 查詢地區列表 -->
  <action name="queryAreaList" class="MarketChanceAction" method="queryAreaList">
   <result name="json" />
  </action>
 </package>
</struts>