添加一个Exception类型,发生该Exception时WEB画面跳转到指定画面

1.customizer.dicon

  <component name="actionCustomizer" class="org.seasar.framework.container.customizer.CustomizerChain">
  </component>


里面追加一下内容
    <initMethod name="addAspectCustomizer">
      <arg>"throwableTransitionInterceptor"</arg>
    </initMethod>


2.ThrowableTransitionInterceptor(自己写的类继承ThrowsInterceptor)类中追加

    public void handleThrowable(TestException e, MethodInvocation invocation) throws Throwable {

        throw e;

    }

3.定义自定Exception  -->>TestException继承RuntimeException类

4.struts-config.xml

    <global-exceptions>    </global-exceptions>

里面追加
      <exception type="framework.ss.exception.runtime.TestException" 
          path="/WEB-INF/view/exception/testException.html" key=""/>




你可能感兴趣的:(添加一个Exception类型,发生该Exception时WEB画面跳转到指定画面)