<interceptors>
<interceptor name="myException" class="org.sixtb.portal.base.interceptor.InterceptorHandler"/>
<!-- 定义一个拦截器栈 -->
<interceptor-stack name="myExceptionInterceptor">
<interceptor-ref name="myException" />
<interceptor-ref name="defaultStack" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="myExceptionInterceptor" />
<global-results>
<result name="msg">/msg.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="msg" />
</global-exception-mappings>
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
/**
* @author wuzefeng
* @version 1.0 @date 2013-9-17
*/
public class InterceptorHandler extends AbstractInterceptor {
@Override
public String intercept(ActionInvocation arg0) throws Exception {
// TODO
try {
arg0.invoke();
} catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
}
return null;
}
}