Failed to catch ajax error in JSF 2 application

I do not understand why I cannot get a warning about p: ajaxStatus if an exception occurs.

I mainly use this code on the facelet page

<p:ajaxStatus onerror="alert('Error occurred!')" />

<p:commandLink  title="Delete" process="@this" 
    actionListener="#{myBean.deleteData}">
    <h:outputText value="Delete" />                 
</p:commandLink>

In my bean, I threw an exception only to check ajax state

public void deleteData(ActionEvent event) {
    throw new CustomException("Testing");
}

I am not sure, but the warning is not triggered by ajax request.

I checked firebug and saw this ajax answer.

<?xml version='1.0' encoding='UTF-8'?>
<partial-response><changes><update id="javax.faces.ViewState"><![CDATA[5240489117331224423:7642972336085906948]]></update></changes></partial-response>

But when I checked the server log, I saw this logged

javax.faces.event.AbortProcessingException: /pages/members.xhtml @208,128 actionListener="#{myBean.deleteData}": com.test.CustomException: Testing

Why is this so?

Charts 3.2 / Glassfish / JSF 2.0

+3
source share
1 answer

From the documentation 3.2 << 20>:

onerror: Client side callback to execute when an ajax request fails.

In Firebug you get ajax regular response. Thus, the request did not fail. From my understanding, a denial means no or an invalid answer. What you see is the expected behavior.

. perissf, FacesMessage h:messages ajax.

+2

All Articles