Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF 2: Facelets composition (template) not rendered for error-page
    primarykey
    data
    text
    <p>I'm using JSF 2.0 with Facelets in a Java EE 6 application server (GlassFish v3). I have configured an error page for exceptions, in web.xml:</p> <pre><code>&lt;error-page&gt; &lt;exception-type&gt;java.lang.Throwable&lt;/exception-type&gt; &lt;location&gt;/error-all.xhtml&lt;/location&gt; &lt;/error-page&gt; </code></pre> <p>This is the <code>/error-all.xhtml</code> test page:</p> <pre><code>&lt;!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;ui:composition 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" template="/resources/templates/decorator.xhtml"&gt; &lt;ui:define name="title"&gt;Title&lt;/ui:define&gt; &lt;ui:define name="body"&gt; &lt;h1&gt;Body&lt;/h1&gt; &lt;/ui:define&gt; &lt;/ui:composition&gt; </code></pre> <p>I implemented a managed bean that throws a RuntimeException on purpose when I click on one of my commandLinks. When that happens, the contents of the /error-all.xhtml page are shown, but it doesn't get processes by Facelets, so the <strong>template="/resources/templates/decorator.xhtml"</strong> is not applied. </p> <p>Using Google Chrome, I see only "Title" and "Body" with no layout as result. If I ask Chrome to inspect the elements, I get the full source code, which includes the <em>ui:composition</em> and <em>ui:define</em> tags, which Chrome obviously doesn't understand. This confirms my theory that the Facelets page is not being processed.</p> <p>So, my question is, how to fix this? How can I make so the error page gets processed and returns the HTML code that is the result of the combination of the template with the contents of the error page?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload