简体   繁体   中英

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

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?

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()" /> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM