Jsf primefaces commandbutton oncomplete未激发

Jsf primefaces commandbutton oncomplete未激发,jsf,primefaces,Jsf,Primefaces,我有以下代码: xhtml: <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui" template="/template.xh

我有以下代码:

xhtml:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
template="/template.xhtml">
<ui:define name="content">

<h:form id="serviceForm">
<h3 class="title">Services</h3>
<p:growl id="msg" showDetail="true" life="3000" autoUpdate="true"/>

<h:panelGrid width="100%">
.... some code....
<p:row>
<p:column colspan="4"> 
<p:dataTable id="search" var="service" value="#{bean.services}" editable="true"> 
<p:ajax event="rowEdit" listener="#{bean.onEdit}" update=":serviceForm:msg" />
<p:ajax event="rowEditCancel" listener="#{bean.onCancel}" update=":serviceForm:msg" />    
... some rows that works fine  .....          
</p:dataTable>
</p:column>
</p:row>
<p:row>
<p:column>&#160;</p:column>
</p:row>
<p:row>
<p:column>
<h:form id="addForm">
... this call work perfectly ....
<p:commandButton id="btnAdd" value="New  Service" onclick="PF('add').show()" immediate="true"/>

<p:dialog id="add" widgetVar="add" header="Add New Service" showEffect="clip" 
hideEffect="explode" position="center,center" width="520" modal="true" closable="false"
closeOnEscape="true" resizable="false" 
>
<h:panelGrid width="100%">
<p:row>
<p:column>
<h:outputLabel value="Cve Service" />
</p:column>
</p:row>
... some another fields that works ok ...
<p:row>
<p:column>
.... HERE IS THE PROBLEM ON COMPLETE TO CLOSE DIALOG ITS NOT WORKING ...
<p:commandButton id="addServ" value="Adding" onComplete="PF('add').hide()"  actionListener="#{bean.add}"/>
.. this button its working fine
<p:commandButton immediate="true" id="cancela" value="Cancelar" onclick="PF('add').hide()" />
<p:growl id="msgAdd" showDetail="true" life="5000" autoUpdate="true"/>
</p:column>
</p:row>
</h:panelGrid>
</p:dialog>
</h:form>
</p:column> 
</p:row>

</h:panelGrid>  
</h:form>
</ui:define>

</ui:composition>
其想法是,在执行操作后,commandbutton关闭打开的对话框窗口,但实际上并没有发出简单的警报,以查看onComplete事件是否正在触发,但它不起作用

我试过几种方法,有什么问题吗


非常感谢。

我还没有测试,但我想解决办法是使用

oncomplete="PF('add').hide()"
我相信事件处理程序(on…)总是完全小写的

oncomplete="PF('add').hide()"