2 Replies Latest reply on Oct 12, 2010 6:13 AM by hammerhai

    Custom error page layout problem

    hammerhai

      Hi,

       

      first I have to apologize: I'm new to Richfaces and JSF. In my project I use Richfaces 3.3.3.Final and Facelets as view handler. I try to define a custom error page like this:

       

      <error-page>
        <error-code>404</error-code>
        <location>/faces/error.xhtml</location>
      </error-page>

       

      <error-page>

        <error-code>404</error-code>

        <location>/faces/error.xhtml</location>

      </error-page>

       

       

      My error page uses facelet ui:composition and looks like this:

       

       

      <html xmlns="http://www.w3.org/1999/xhtml"

      xmlns:ui="http://java.sun.com/jsf/facelets"

      xmlns:f="http://java.sun.com/jsf/core"

      xmlns:h="http://java.sun.com/jsf/html"

      xmlns:a4j="http://richfaces.org/a4j"

      xmlns:rich="http://richfaces.org/rich">


      <ui:composition template="./templates/mainTemplate.xhtml">

      <ui:define name="header">

      <ui:include src="./pages/header.xhtml" />

      </ui:define>

      <ui:define name="content">

      <rich:panel id="contentRichPanel" style="position: relative;">

      <ui:include src="./pages/error.xhtml" />

      </rich:panel>

      </ui:define>

      <ui:define name="footer">

      <ui:include src="./pages/footer.xhtml" />

      </ui:define>

      </ui:composition>

      </html>

       

      Now everything is fine if I display the page "standalone", i.e. entering this URL: http://server:port/App/faces/error.xhtml

      But if the error page occurs as a result of an 404 error some style information is missing.

      If I look at the source code the two pages differ by head:

      error.xhtml call by my self:

       

      <head>

      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

      <script src="/Client/faces/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js" type="text/javascript"></script>

      <script src="/Client/faces/a4j/g/3_3_3.Final/org/richfaces/ui.pack.js" type="text/javascript"></script>

      <link class="component" href="/Client/faces/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/basic_both.xcss/DATB/eAGTcz60MXT5DGkAD2IDhA__" rel="stylesheet" type="text/css" />

      <link class="component" href="/Client/faces/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/extended_both.xcss/DATB/eAGTcz60MXT5DGkAD2IDhA__" media="rich-extended-skinning" rel="stylesheet" type="text/css" />

      <link class="component" href="/Client/faces/a4j/s/3_3_3.Finalcss/panel.xcss/DATB/eAGTcz60MXT5DGkAD2IDhA__" rel="stylesheet" type="text/css" />

      <link class="component" href="/Client/faces/a4j/s/3_3_3.FinalMETA-INF/skins/glassX.xcss/DATB/eAGTcz60MXT5DGkAD2IDhA__" rel="stylesheet" type="text/css" />

      <link class="component" href="/Client/faces/a4j/s/3_3_3.FinalMETA-INF/skins/glassXExt.xcss/DATB/eAGTcz60MXT5DGkAD2IDhA__" media="rich-extended-skinning" rel="stylesheet" type="text/css" />

      <script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script>

      <link href="/Client/css/admin-style.css" rel="stylesheet" type="text/css" />

      <link href="/Client/css/header.css" rel="stylesheet" type="text/css" />

      <link href="/Client/css/content.css" rel="stylesheet" type="text/css" />

      <link href="/Client/css/footer.css" rel="stylesheet" type="text/css" />

      <title>Title</title>

      </head>

       

      But if the page will be displayed as result of an error the head looks like this:

       

      <head>

      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

      <link href="/Client/css/admin-style.css" rel="stylesheet" type="text/css" />

      <link href="/Client/css/header.css" rel="stylesheet" type="text/css" />

      <link href="/Client/css/content.css" rel="stylesheet" type="text/css" />

      <link href="/Client/css/footer.css" rel="stylesheet" type="text/css" />

      <title>Title</title>

      </head>

       

      So where is my mistake?

       

      Appreciate any help.