request error, status : 0 pop up with a4j:support

224 views Asked by At

I am encountering a pop up window with error message "Request error, status :0" when onclick event is triggered by a4j:support inside an h:commandButton.

    <h:commandButton id="btn1" action="#{beanA.method1}">

          <a4j:support event="onclick" action="#{beanB.method1}" reRender="somePanelGrid" />

    </h:commandButton>

I also tried using a4j:jsFunction for beanB.method1 and use the onclick attribute of the h:commandButton but the error keeps showing on pop up/alert box. Removing the a4j:support removes the error; however, i still need to execute the beanB.method1 when the commandButton is clicked. What can be the cause of this error? Is there an alternate or better way of doing this?

1

There are 1 answers

0
Paul Lo On

I think it's because you send multiple request to server-side in the same time when you click, I would rather invoke beanB.method1() in beanA.method1(), or delay one of the action to oncomplete stage to get around this issue:

   <a4j:jsFunction name="function1" action="#{beanB.method1}" reRender="somePanelGrid" />
   <h:commandButton id="btn1" action="#{beanA.method1}" oncomplete="function1()" />