首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 其他相关 >

配置全局的异常页面

2012-09-14 
配置全局的错误页面1.web.xml中!-- error页面-- error-pageerror-code404/error-codelocation/e

配置全局的错误页面

1.web.xml中
<!-- error页面-->
 <error-page>
  <error-code>404</error-code>
  <location>/error.jsp</location>
 </error-page>
 <error-page>
  <error-code>500</error-code>
  <location>/error.jsp</location>
 </error-page>
 <error-page>
  <error-code>503</error-code>
  <location>/error.jsp</location>
 </error-page>
2.struts.xml中
        <global-results>
            <result name="error">/error.jsp</result>
        </global-results>

        <global-exception-mappings>
            <exception-mapping exception="java.lang.Exception" result="error"/>
        </global-exception-mappings>

热点排行