1,定义一个拦截器类继承 AbstractInterceptor 或者 MethodFilterInterceptor
2.在struts.xml里面定义如下
<interceptors>
<interceptor name="encodingInterceptor"class="sy.interceptor.EncodingInterceptor">
<interceptor-stack name="encodingStack">
<interceptor-ref name="defaultStack"></interceptor>
<interceptor-ref name="encodingInterceptor"></interceptor>
</interceptor-stack>
</interceptor>
</interceptors>
<default-interceptor-ref name="encodingStack"></default-interceptor-ref>