struts2.xml的特殊配置

来源:互联网 发布:java怎么用hadoop 编辑:程序博客网 时间:2024/06/05 09:28

<?xmlversion="1.0"encoding="UTF-8"?>

<!DOCTYPE strutsPUBLIC

"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"

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


<struts>

<constantname="struts.enable.DynamicMethodInvocation"value="false"/>


<constantname="struts.devMode"value="true"/>

<packagename="default"namespace="/"extends="json-default">

<!--配置拦截器 -->


<interceptors>

<interceptorname="test"class="com.lanou.test.TestInterceptor"></interceptor>

<interceptorname="methodTest"class="com.lanou.test.MethodInterceptor"></interceptor>

<!-- 拦器栈-->

<interceptor-stackname="allTest">

<interceptor-refname="test"></interceptor-ref>

<interceptor-refname="defaultStack"></interceptor-ref>

</interceptor-stack>

<interceptor-stackname="methodallTest">

<interceptor-refname="methodTest">

    <!--设置拦截方法  ,白名单的 name="includeMethods"-->

<paramname="excludeMethods">

  login,register

</param>

</interceptor-ref>

<interceptor-refname="defaultStack"></interceptor-ref>

</interceptor-stack>

</interceptors>

<actionname="*" class="com.lanou.test.TestAction"  method="{1}" >

  <result name="{1}">

    /success.html

 

  </result>

</action>

<!--默认访问的action ref关联 -->

<!-- <default-action-ref name="aaa">

</default-action-ref> -->

<!-- 默认的拦截器 -->


<!--配置action的默认类 -->

<!-- <default-class-ref class="defaultStack"></default-class-ref> -->

<!--全局结果异常 -->

<!-- <global-exception-mappings>

<exception-mapping result="error" exception="java.long.exception"></exception-mapping>

</global-exception-mappings> -->

<!--全局返回值配置 -->

<!-- <global-results> <result name="error" type="redirect"> /error.html 

</result> </global-results> <default-interceptor-ref name="defaultStack"> 

</default-interceptor-ref> -->

<!-- class属性可以没有,因为有默认的 -->

<!-- <action name="aaa"></action> -->

<!-- <result-types> 返回值类型 <result-type name="" class=""></result-type> 

</result-types> -->

</package>



</struts>

原创粉丝点击