---
title: "如何配置struts2拦截器"
author: "hwpok"
date: "2008-10-13T14:32:00Z"
tags: []
slug: "struts2"
draft: false
lastmod: "2008-10-13T14:32:00Z"
id: 615817
url: "https://hwpok.iteye.com/blog/615817"
---

&lt;!--&lt;br /&gt; &lt;br /&gt; Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt; http://www.CodeHighlighter.com/&lt;br /&gt; &lt;br /&gt; --&gt;&lt;?xml version="1.0" encoding="UTF-8" ?&gt;  
&lt;!DOCTYPE struts PUBLIC  
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"  
    "http://struts.apache.org/dtds/struts-2.0.dtd"&gt;  
&lt;struts&gt;  
    &lt;constant name="struts.devMode" value="true" /&gt;  
    &lt;constant name="struts.i18n.reload" value="true" /&gt;  
    &lt;constant name="struts.configuration.xml.reload" value="true" /&gt;  
    &lt;constant name="struts.i18n.encoding" value="gb2312" /&gt;  
    &lt;constant name="struts.custom.i18n.resources"  
        value="messageResource" /&gt;  
    &lt;constant name="struts.action.extension" value="jspa" /&gt;  
    &lt;constant name="struts.multipart.saveDir" value="/tmp" /&gt;  
    &lt;constant name="struts.multipart.maxSize" value="10000000" /&gt;  
    &lt;constant name="struts.ui.theme" value="simple" /&gt;  
    &lt;package name="default" extends="struts-default"&gt;  
        &lt;interceptors&gt;  
            &lt;interceptor name="exceptionInterceptor"  
                class="org.roadway.wisp.zd.util.ExceptionInterceptor"&gt;  
                &lt;param name="interceptorName"&gt;  
                    self-interceptor  
                &lt;/param&gt;  
            &lt;/interceptor&gt;  
            &lt;interceptor-stack name="myStack"&gt;  
                &lt;interceptor-ref name="defaultStack" /&gt;  
                &lt;interceptor-ref name="exceptionInterceptor" /&gt;  
            &lt;/interceptor-stack&gt;  
        &lt;/interceptors&gt;  
        &lt;default-interceptor-ref name="myStack" /&gt;  
        &lt;global-exception-mappings&gt;  
            &lt;exception-mapping result="error"  
                exception="java.lang.Exception" /&gt;  
        &lt;/global-exception-mappings&gt;  
    &lt;/package&gt;  
    &lt;include file="register.xml" /&gt;  
&lt;/struts&gt;