简体   繁体   English

请求错误,状态:0弹出a4j:support

[英]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内的a4j:support触发onclick事件时,我遇到一个弹出窗口,显示错误消息“请求错误,状态:0”。

    <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. 我也尝试对beanB.method1使用a4j:jsFunction并使用h:commandButton的onclick属性,但错误始终显示在弹出/警告框中。 Removing the a4j:support removes the error; 删除a4j:support可以消除错误; however, i still need to execute the beanB.method1 when the commandButton is clicked. 但是,单击commandButton时,我仍然需要执行beanB.method1。 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: 我认为这是因为你在同一时间发送多个请求给服务器端,当你点击,我宁愿调用beanB.method1()beanA.method1()或延缓行动之一oncomplete阶段来解决这个问题:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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