0 Replies Latest reply on Nov 21, 2007 9:37 AM by Lars Ködderitzsch

    Exception in Ajax request leads to unstyled error page

    Lars Ködderitzsch Newbie

      I have an error page configured in my web.xml, which is essentially an plain jsp which redirects to a custom JSF error page.
      This is done because error pages are (in JSF 1.1) not executed in a JSF request cycle.

      When an exeption in an ajax request occurs the error page is displayed unstyled (similar to when you have a navigation during an ajax request and forget to specify in the navigation rule).
      The browser URL shows that the redirect sent by the error jsp has not been honored (browser URL stays on the same page as before).

      On non-ajax request the error page behaves as normal.

      Snip from web.xml (error page config):

       <error-page>
       <error-code>404</error-code>
       <location>/404.jsp</location>
       </error-page>
       <error-page>
       <exception-type>java.lang.Throwable</exception-type>
       <location>/500.jsp</location>
       </error-page>
      


      Contents of 500.jsp:
      <%@page import="blablabla.ErrorPageSupport"%>
      <%@page session="true" isErrorPage="true"%>
      <%
       if (exception != null) {
       session.setAttribute(ErrorPageSupport.SESSION_VAR_EXCEPTION, exception);
       session.setAttribute(ErrorPageSupport.SESSION_VAR_EXCEPTION_TIME, new java.sql.Timestamp(System.currentTimeMillis()));
       response.sendRedirect(request.getContextPath()+ "/faces/errors/500.jsf");
       }
      %>
      


      Do you have any advise how to work around this "unstyled page" issue?

      Thank you,
      Lars Koedderitzsch