Jsf primefaces命令按钮不执行操作

Jsf primefaces命令按钮不执行操作,jsf,primefaces,Jsf,Primefaces,我需要帮助。我有一个“表单”,它通过p:commandButton调用p:dialog。该p:dialog包括其他p:commandButton,但第二个按钮没有采取任何行动,这对我来说很奇怪,因为第一个按钮工作正常 守则: <ui:define name="body"> <br/> <br/> <br/> <p:ajaxStatus onstart="P

我需要帮助。我有一个“表单”,它通过p:commandButton调用p:dialog。该p:dialog包括其他p:commandButton,但第二个按钮没有采取任何行动,这对我来说很奇怪,因为第一个按钮工作正常

守则:

<ui:define name="body">            
        <br/>
        <br/>
        <br/>
        <p:ajaxStatus onstart="PF('statusDialog').show()" onsuccess="PF('statusDialog').hide()" />
        <p:dialog widgetVar="statusDialog" modal="true" draggable="false" closable="false" resizable="false" showHeader="false">
            <p:graphicImage value="/resources/Images/ajax-loader.gif" alt="Por favor espere..." />
        </p:dialog>

        <h:form id="BuscarEmpresaForm">
            <h:panelGroup id="display">
                <h:panelGrid columns="2" style="margin-left: 10px;">
                    <p:outputLabel value="#{bundle.BuscarEmpresaBuscarLabel}" />  
                    <h:outputLabel/>
                    <h:selectOneRadio id="idBusquedaRadio" value="#{cupoController.radioButtonBusqueda}">
                        <f:selectItem itemLabel="#{bundle.BuscarEmpresaCodigoLabel}" itemValue="Codigo" />
                        <f:selectItem itemLabel="#{bundle.BuscarEmpresaNombreLabel}" itemValue="Nombre" />
                    </h:selectOneRadio>
                    <h:outputLabel/>
                    <p:inputText id="empresa" value="#{cupoController.empresaTextoBusqueda}" required="true" requiredMessage="El campo es requerido"/>  

                    <!--THIS BUTTON WORKS-->

                    <p:commandButton value="Buscar" actionListener="#{cupoController.prepareCreateEmpresa()}" action="#{cupoController.searchEmpresa()}" oncomplete="PF('dlg1').show();" update=":confirmDialogEmpresa">                            
                    </p:commandButton>   
                    <p:message  for="empresa"/>

                </h:panelGrid>
            </h:panelGroup>
        </h:form>
        <p:dialog id="dialog1" header="Mensaje" widgetVar="dlg1" minHeight="40" modal="true" appendTo="@(body)">
            <h:form id="confirmDialogEmpresa">
                <h:panelGroup id="display">
                    <h:panelGrid columns="2" rendered="#{cupoController.selectedEmpresa.codcor != null}">
                        <p:outputLabel value="Empresa encontrada, Continuar?"/>
                        <h:outputLabel/>                             
                        <p:outputLabel value="Nombre: #{cupoController.selectedEmpresa.razonsocial}"/> 
                        <h:outputLabel/> 
                        <p:outputLabel value="RUC: #{cupoController.selectedEmpresa.ruc}"/> 
                        <h:outputLabel/> 

                         <!--THIS BUTTON DOES NOT WORK-->

                        <p:commandButton value="Si" action="#{cupoController.buscarCupo}" icon="ui-icon-check"/>
                        <p:commandButton value="No" onclick="dlg1.hide();" icon="ui-icon-close" update="@none"/>  
                    </h:panelGrid>
                    <h:panelGrid columns="2" rendered="#{cupoController.selectedEmpresa.codcor == null}" > 
                        <p:outputLabel value="Empresa no encontrada"/>
                        <h:outputLabel/> 
                        <p:messages />
                        <h:outputLabel/>
                        <p:commandButton value="Aceptar" onclick="dlg1.hide();" icon="ui-icon-close" update="@none"/>
                    </h:panelGrid>
                </h:panelGroup>
            </h:form>
        </p:dialog>

    </ui:define> 




我尝试过将p:commandButton替换为h:commandButton,但结果相同


提前感谢。

我发现了问题,并与主题相关:

就我而言,我感到困惑。我在托管bean中混合了CDI注释和JSF注释,产生了一种奇怪的行为。最后,我修复了只允许JSF注释的问题


核心:JSF2.0、PrimeFaces 5.0、GlassFish 4.1

我认为您正在尝试在单击按钮后确认操作。为此,您应该使用primefaces提供的组件。是的,您是对的。但我需要做一些定制的动作。这就是我选择这种方式的原因。Thks