添加一個Exception類型,發生該Exception時WEB畫面跳轉到指定畫面

1.customizer.diconhtml

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


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


2.ThrowableTransitionInterceptor(本身寫的類繼承ThrowsInterceptor)類中追加java

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

        throw e;

    }

3.定義自定Exception  -->>TestException繼承RuntimeException類code

4.struts-config.xmlcomponent

<global-exceptions>    </global-exceptions>

裏面追加
<exception type="framework.ss.exception.runtime.TestException" 
          path="/WEB-INF/view/exception/testException.html" key=""/>
相關文章
相關標籤/搜索