如果程序报500或者404错误时,如何把它转发到自定义的另外一个界面,而不显示500或者404错误的页面
请哪位高手指点指点!
[email protected]

解决方案 »

  1.   

    <error-page>
        <error-code>404</error-code>
        <location>/index.jsp</location>
    </error-page>
    <error-page>
        <error-code>500</error-code>
        <location>/index.jsp</location>
    </error-page>
      

  2.   

    不知道你用的是不是TOMCAT环境
    是的话看下页面下面提示什么错误
    然后搜去吧,很容易解决的
      

  3.   

    捕获异常,给个友好的提示页面,如'您访问的页面*****,请****!'的jsp啊 或者
    xml配置控制
    <error-page> 
        <error-code>404 </error-code> 
        <location>/index.jsp </location> 
    </error-page> 
    <error-page> 
        <error-code>500 </error-code> 
        <location>/index.jsp </location> 
    </error-page>
      

  4.   

    在xml配置中写上下面的.
    <error-page> 
        <error-code>404 </error-code> 
        <location>/这里写你转发到自定义的另外一个界面的名字</location> 
    </error-page> 
    <error-page> 
        <error-code>500 </error-code> 
        <location>/这里写你转发到自定义的另外一个界面的名字</location> 
    </error-page>
      

  5.   

    xml配置控制 
    <error-page> 
        <error-code>404 </error-code> 
        <location>/index.jsp </location> 
    </error-page> 
    <error-page> 
        <error-code>500 </error-code> 
        <location>/index.jsp </location> 
    </error-page>
      

  6.   

    在web-xml里面设置 error-page> 
        <error-code>404 </error-code> 
        <location>/404.jsp </location> 
    </error-page> 
    <error-page> 
        <error-code>500 </error-code> 
        <location>/500.jsp </location> 
    </error-page>