就是在web-xml配置一下,当出现所有的错误时候(包括500 404 等错误)自动跳转的一个指定的页面。

解决方案 »

  1.   

    <error-page>
    <error-code>401</error-code>
    <location>/error/401.htm</location>
    </error-page>
    <error-page>
    <error-code>403</error-code>
    <location>/error/403.htm</location>
    </error-page>
    <error-page>
    <error-code>404</error-code>
    <location>/error/404.htm</location>
    </error-page>
    <error-page>
    <error-code>500</error-code>
    <location>/error/500.htm</location>
    </error-page>
    <error-page>
    <exception-type>java.lang.NullPointerException</exception-type>
    <location>/error/npe.htm</location>
    </error-page>-->
      

  2.   

    tomcat配置错误页跳转
    修改你部署项目的WEB-INF目录下的web.xml,例子内容如下:
    <error-page>
              <error-code>404</error-code>
              <location>/errorJumpToFirstPage.jsp</location>
      </error-page>
      <error-page>
              <error-code>400</error-code>
              <location>/errorJumpToFirstPage.jsp</location>
      </error-page>
    详细内容参考:tomcat配置错误页跳转