custom error page not working

Splash Forums PrettyFaces Users custom error page not working

This topic contains 12 replies, has 3 voices, and was last updated by  m1m 10 years, 4 months ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
  • #18027



    I’m using jsf 2.0 with prettyfaces 3.3.0. My custom <error-page> in web.xml stopped working since using prettyfaces.




    what do you mean with “not working”? What do you see instead? Is /error/500 mapped using PrettyFaces?




    /error/* is a servlet doing redirection and logging. It’s not mapped in prettyfaces.

    I have the following mapping:

    <url-mapping id="page">
    <pattern value="/#{/\d+/id}/"/>
    <view-id value="/page.html"/>

    But when I enter something not matching eg I got com.sun.faces.context.FacesFileNotFoundException but my servlet is not invoked. I see default browser error page


    I guess you are getting a 404 instead of a 500 error code now, correct? I think previously your requests did always hit the FacesServlet (*.jsf or /faces/*) and Mojarra is throwing this exception if the page does not exist. But now your request won’t hit the FacesServlet because the URL doesn’t match the mapping of the FacesServlet. So you are just getting a 404 error, which is the more correct answer according to HTTP.

    You could try to map the 404 error page by doing something like this:




    Actually, I already had 404 mapping, it dosen’t help


    Hmmm! Which error code does the webapp send? 404? Did your custom 404 page work before? Does it work if you remove PrettyFaces?


    I’ve actually seen this as well. I hadn’t thought that it was a PrettyFaces problem, though. For me it happens on several application servers.


    Actually, just using JSF is enough to cause this issue for me sometimes.


    Perhaps the custom error page doesn’t work if HttpServletResponse.sendError() is used!?!?!


    Perhaps the custom error page doesn’t work if HttpServletResponse.sendError() is used!?!?!


    I somehow doubt that, but if so, I guess it’s time to start looking for how to make a proper 404 page show up.



    You are right. I just had a look at the spec (10.9.2):

    If the sendError method is called on the response, the container consults the list of

    error page declarations for the Web application that use the status-code syntax and

    attempts a match. If there is a match, the container returns the resource as indicated

    by the location entry.

    So this issue seems to have some other cause.



    Yes, the problem is not in prettyfaces. Sorry for confusion.

    The solution is here:

Viewing 13 posts - 1 through 13 (of 13 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.