Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The particular example does only one useful thing: it saves the view ID as a request attribute so that you can use for example</p> <pre><code>&lt;h:link value="Go back to previous page" outcome="#{currentViewId}" /&gt; </code></pre> <p>But this is not tremendously useful as the raw request URI is already available by the <code>&lt;error-page&gt;</code>'s default request attribute <code>javax.servlet.error.request_uri</code>.</p> <pre><code>&lt;h:outputLink value="#{requestScope['javax.servlet.error.request_uri']}"&gt;Go back to previous page&lt;/h:outputLink&gt; </code></pre> <p>However one thing what a custom <code>ExceptionHandler</code> is really useful for is that it allows you to deal with exceptions during <strong>ajax requests</strong>. By default they have namely no single form of helpful feedback in the client side. Only in Mojarra with project stage set to "Development" you'll see a bare JavaScript alert message with the exception message. But that's it. There is no single form of feedback in "Production" stage. With a custom <code>ExceptionHandler</code> you would be able to parse the <code>web.xml</code> to find the error page locations, create a new <code>UIViewRoot</code> with it and force JSF to set ajax rendering to <code>@all</code>. </p> <p>So, <em>basically</em>:</p> <pre><code>String errorPageLocation = "/WEB-INF/errorpages/500.xhtml"; context.setViewRoot(context.getApplication().getViewHandler().createView(context, errorPageLocation)); context.getPartialViewContext().setRenderAll(true); context.renderResponse(); </code></pre> <p>See also this related question: <a href="https://stackoverflow.com/questions/10449862/what-is-the-correct-way-to-deal-with-jsf-2-0-exceptions-for-ajaxified-components">What is the correct way to deal with JSF 2.0 exceptions for AJAXified components?</a> and this blog: <a href="http://balusc.blogspot.com/2012/03/full-ajax-exception-handler.html" rel="nofollow noreferrer">Full Ajax Exception Handler</a>.</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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