strut1中关于 异常的处理

来源:互联网 发布:数据恢复精灵破解 编辑:程序博客网 时间:2024/04/30 08:04

1.手动式异常直接在代码中切入异常的扑捉。

2.声明是异常

web.xml 中规定全局异常处理   

  <!--
  <error-page>
     <error-code>500</error-code>
     <location>/common/error.jsp</location>
  </error-page>
   -->
   
  <!--
  <error-page>
     <exception-type>java.lang.RuntimeException</exception-type>
     <location>/common/error.jsp</location>
  </error-page>
   -->

struts1 中的全局异常 绑定国际化

 <global-exceptions>
        <exception key="exception" type="java.lang.RuntimeException" path="/common/message.jsp"/>
    </global-exceptions>


key="exception"国际化资源文件中