1 Reply Latest reply on Oct 19, 2006 10:40 AM by Louis Coetzee

    Custome 404 error page display problem

    Louis Coetzee Apprentice

      Hi,

      I have annotated my exception class with the @HttpError to return the 404 error code:

      @ApplicationException(rollback=true)
      @HttpError(errorCode=HttpServletResponse.SC_NOT_FOUND)
      public class NAPEntityNotFoundException extends Exception implements Serializable {
      


      When I throw the exception I get redirected to the standard tomcat 404 error page. Good.

      However, ideally I would like to display my own error page. When I configure this in my web.xml:

      <error-page>
       <error-code>404</error-code>
       <location>/public/error/errorPage.xhtml</location>
       </error-page>

      something weird happens.

      I do not get redirected to any error page, but instead my browser pops up a dialog with the following message:
      The file "viewContent.jsf" is of type application/xhtml, and Mozilla does not know how to handle this file type. This file is located at: http://localhost:8080 What should Mozilla do with this file? Open it, Save it


      Note that the page "viewContent.jsf" above is the page which was being displayed at the time when I threw the exception. Any suggestions as to what I can do ?

      Thanks

      Louis


        • 1. Re: Custom 404 error page display problem
          Louis Coetzee Apprentice

          Interestingly enough the problem is solved when configuring the errorpage as a jsf not xhtml

          <error-page>
           <error-code>404</error-code>
           <location>/public/error/errorPage.jsf</location>
           </error-page>


          I have noticed that the Seam blog example uses
          <error-page>
           <error-code>404</error-code>
           <location>/seam/404.xhtml</location>
           </error-page>
          


          Slightly confusing ;-)

          L