开发者

Problem displaying error page running Tomcat 7 in Eclipse Helios

When I run an instance of my local Tomcat 7 server within Eclipse, I am not able to display my custom error page. I have included the following in my web.xml deployment descriptor and have verified that the file is in the appropriate location.

 <error-page>
    <error-code>404</error-code>
    <location>/WEB-INF/404.jsp</location>
  </error-page>

When I attempt to navigate to a resource that doesn't exists, it should display my 404.jsp page. However, the browser (Chrome, IE, and FireFox) all 开发者_高级运维display the "Oops this link appears to be broken", or "This page cannot be displayed" page instead.

Is there something I need to configure in Eclipse/Tomcat to allow custom error pages?


It should be possible to place your custom error page in the WEB-INF directory. However, I had an issue with this when a servlet was mapped to the /* URL pattern. You could try mapping to / instead, i.e.

    <servlet-mapping>
      <servlet-name>wsDispatcher</servlet-name>
      <url-pattern>/</url-pattern> 
    </servlet-mapping>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜