web程序出现异常时实现页面跳转

在web.xml配置文件下配置跳转页面


    <error-page>    
        <error-code>403error-code>    
        <location>/error-404.htmllocation>    
    error-page>    
    <error-page>    
        <error-code>404error-code>    
        <location>/error-404.htmllocation>    
    error-page>    
    <error-page>    
        <error-code>405error-code>    
        <location>/error-404.htmllocation>    
    error-page>    
    <error-page>    
        <error-code>500error-code>    
        <location>/error-404.htmllocation>    
    error-page>  
    <error-page>    
        <exception-type>java.lang.Exceptionexception-type>  
        <location>/error-404.htmllocation>    
    error-page>  

你可能感兴趣的:(java,异常,web,web.xml)