Why for every thrown exception always called same(first) ajaxErrorHandler ?
This code is from showcase. I just added form for buttons and chaged titles of error handlers.
Code: Select all
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<!-- With the exception of texts, you can add the button its own JavaScript function. You can define texts: -->
<pe:ajaxErrorHandler
title="Error1"
body="Server return exception {error-name} with description {error-message}"
button="Hide"
widgetVar="myAjaxErrorHandler" buttonOnclick="myAjaxErrorHandler.hide()" />
<!-- In title and body you can use HTML tags too, because the values are not escaped. -->
<pe:ajaxErrorHandler
title="Error2"
body="Server return exception {error-name} with description <b>{error-message}</b>"
button="Hide"
widgetVar="myAjaxErrorHandler" buttonOnclick="myAjaxErrorHandler.hide()"
type="javax.faces.application.ViewExpiredException" />
<!-- An example of protocol, where title and body are defined through <f:facet name="title"> and/or <f:facet name="body"> -->
<pe:ajaxErrorHandler type="java.lang.IllegalStateException" button="Close warning!">
<f:facet name="title">
Error3 <span style="color: red;">{error-name}</span>
</f:facet>
<f:facet name="body">
<div>
<h:form>
<p:tabView >
<p:tab title="Message">
<h:panelGrid columns="2">
<h:outputLabel value="Error message:" />
<h:outputText value="{error-message}" style="font-size: 1.2em;color:navy;" />
<h:outputLabel value="Server name:" />
<h:outputText value="{error-hostname}" style="font-size: 1.2em;color:navy;"/>
</h:panelGrid>
</p:tab>
<p:tab title="Detail">
<div style="overflow: auto; height: 300px; width: 700px;">
{error-stacktrace}
</div>
</p:tab>
</p:tabView>
</h:form>
</div>
</f:facet>
</pe:ajaxErrorHandler>
<h:form>
<!-- AJAX actions, which throw exceptions -->
<p:commandButton action="#{ajaxErrorHandlerController.actionThrowNullPointer}"
value="Example first definition" />
<p:commandButton action="#{ajaxErrorHandlerController.actionSimulateViewExpiredException}"
value="Example second definition" />
<p:commandButton action="#{ajaxErrorHandlerController.actionWrappedException}"
value="Example third definition" />
</h:form>
</h:body>
</html>
How can i set different handlers for different exceptions ?
Thank you.