2013-08-27 4 views
0

<p:dialog> 안에 <h:form>이 있습니다. 대화 상자에 dynamic="true"이 설정되어있는 경우 <p:commandButton>은 아무 작업도 수행하지 않습니다. dynamic="true"을 꺼내면 작동합니다.<p : commandbutton>은 <p : dialog dynamic = "true"> 어떤 작업도 실행하지 않습니다.

내 bean의 뷰 범위가 지정되며 명령 단추는 대화 상자 외부에서 작동합니다. 양식이 중첩되어 있지 않음을 이미 확인했습니다. 여기

뷰입니다 :

<p:dialog header="Editar" widgetVar="dlgChamadoEdit" resizable="true" 
     id="chamadosDlgEdicao" showEffect="fade" hideEffect="drop" 
     dynamic="true" maximizable="true" minimizable="true" width="1000px" 
     height="500px" appendToBody="false" > 

     <h:form id="chamadoEdicao" prependId="false"> 

      <p:messages id="messages" /> 

      <h:inputHidden id="acao" value="#{Chamados.acao}" /> 

      <h:panelGrid columns="4"> 
       <h:outputLabel value="Cliente: " /> 
       <p:inputText value="#{Chamados.chamado.cliente}" type="name" 
        required="true" requiredMessage="Cliente é requerido. " /> 

       <h:outputLabel value="Número: " /> 
       <p:inputText value="#{Chamados.chamado.id}" type="name" 
        readonly="true"> 
        <f:convertNumber integerOnly="true" minIntegerDigits="1" /> 
       </p:inputText> 

       <h:outputLabel value="Nome:" /> 
       <p:inputText value="#{Chamados.chamado.nome}" type="name" 
        required="true" requiredMessage="Nome é requerido. " /> 

       <h:outputLabel value="Status:" /> 
       <p:selectOneMenu styleClass="element select" 
        style="margin-left:20px; width:300px" 
        value="#{Chamados.chamado.status}" converter="javax.faces.Integer"> 
        <f:selectItems value="#{Chamados.keyAsList}" var="status" 
         itemLabel="#{Chamados.listaStatus[status]}" itemValue="#{status}" /> 
       </p:selectOneMenu> 

       <h:outputLabel value="Pessoa de contato: " /> 
       <p:inputText value="#{Chamados.nomePessoaDeContatoString}" 
        type="name" /> 

       <h:outputLabel value="Id da chamada: " /> 
       <p:inputText value="#{Chamados.chamado.idChamada}" type="name" 
        readonly="true" /> 

       <h:outputLabel value="Número do Telefone: " /> 
       <p:inputText value="#{Chamados.chamado.numeroTelefone}" type="name" /> 


       <h:outputLabel value="Prioridade: " /> 
       <p:selectOneMenu styleClass="element select" 
        style="margin-left:20px; width:300px" 
        value="#{Chamados.chamado.prioridade}" 
        converter="javax.faces.Integer"> 
        <f:selectItems value="#{Chamados.prioridadeKeyAsList}" 
         var="prioridade" 
         itemLabel="#{Chamados.listaPrioridade[prioridade]}" 
         itemValue="#{prioridade}" /> 
       </p:selectOneMenu> 

       <h:outputLabel value="Numero de serie do fabricante: " /> 
       <p:inputText value="#{Chamados.chamado.numeroSerieFabricante}" 
        type="name" /> 

       <h:outputLabel value="Criado em: " /> 
       <p:inputText value="#{Chamados.chamado.criadoEm}" type="name" 
        size="16" maxlength="16" readonly="true" 
        onkeypress="Mascara(this,Data);"> 
        <f:convertDateTime pattern="dd/MM/yyyy HH:mm" 
         timeZone="#{initParam.timezone}" /> 
       </p:inputText> 


       <h:outputLabel value="Numero de serie: " /> 
       <p:inputText value="#{Chamados.chamado.numeroSerie}" type="name" /> 

       <h:outputLabel value="Fechado em: " /> 
       <p:inputText value="#{Chamados.chamado.fechadoEm}" type="name" 
        size="16" maxlength="16" readonly="true"> 
        <f:convertDateTime pattern="dd/MM/yyyy HH:mm" 
         timeZone="#{initParam.timezone}" /> 
       </p:inputText> 

       <h:outputLabel value="Item: " /> 
       <p:inputText value="#{Chamados.chamado.item}" type="name" /> 

       <h:outputLabel value="Numero do contrato: " /> 
       <p:inputText value="#{Chamados.chamado.numeroContrato}" type="name" /> 

       <h:outputLabel value="Descricao: " /> 
       <p:inputText value="#{Chamados.chamado.descricao}" type="name" /> 

       <h:outputLabel value="Data Final: " /> 
       <p:inputText value="#{Chamados.chamado.dataFinal}" type="name" 
        size="16" maxlength="16" readonly="true"> 
        <f:convertDateTime pattern="dd/MM/yyyy HH:mm" 
         timeZone="#{initParam.timezone}" /> 
       </p:inputText> 

       <h:outputLabel value="Grupo de itens: " /> 
       <p:inputText value="#{Chamados.nomeGrupoItemString}" type="name" /> 

       <h:outputLabel value="Assunto: " /> 
       <p:inputText value="#{Chamados.chamado.assunto}" type="name" 
        required="true" requiredMessage="Assunto é requerido. " /> 

      </h:panelGrid> 

      <div class="form_description"> 
       <p></p> 
      </div> 

      <h:panelGrid columns="4"> 
       <h:outputLabel value="Origem:" /> 
       <p:selectOneMenu styleClass="element select" 
        style="margin-left:20px; width:300px" 
        value="#{Chamados.chamado.origem}" converter="javax.faces.Integer"> 
        <f:selectItems value="#{Chamados.origensKeyAsList}" var="origem" 
         itemLabel="#{Chamados.listaOrigens[origem]}" 
         itemValue="#{origem}" /> 
       </p:selectOneMenu> 

       <h:outputLabel value="Processador: " /> 
       <p:inputText value="#{Login.usuario.nome}" type="name" 
        readonly="true" /> 

       <h:outputLabel value="Tipo problema:" /> 
       <p:selectOneMenu styleClass="element select" 
        value="#{Chamados.chamado.tipoProblema}" 
        style="margin-left:20px; width:300px" 
        converter="javax.faces.Integer"> 
        <f:selectItems value="#{Chamados.tiposProblemasKeyAsList}" 
         var="problema" 
         itemLabel="#{Chamados.listaTiposProblemas[problema]}" 
         itemValue="#{problema}" /> 
       </p:selectOneMenu> 

       <h:outputLabel value="Fila: " /> 
       <p:selectOneMenu styleClass="element select" 
        value="#{Chamados.chamado.fila}" 
        style="margin-left:20px; width:300px"> 
        <f:selectItems value="#{Chamados.filasKeyAsList}" var="fila" 
         itemLabel="#{Chamados.listaFilas[fila]}" itemValue="#{fila}" /> 
       </p:selectOneMenu> 


       <h:outputLabel value="Tipo Chamado: " /> 
       <p:selectOneMenu styleClass="element select" 
        value="#{Chamados.chamado.tipoChamado}" 
        style="margin-left:20px; width:300px" 
        converter="javax.faces.Integer"> 
        <f:selectItems value="#{Chamados.tiposchamadosKeyAsList}" 
         var="tipochamado" 
         itemLabel="#{Chamados.listaTiposChamados[tipochamado]}" 
         itemValue="#{tipochamado}" /> 
       </p:selectOneMenu> 

       <h:outputLabel value="Responsável: " /> 
       <p:inputText value="#{Chamados.nomeResponsavelString}" type="name" /> 


      </h:panelGrid> 

      <div class="form_description"> 
       <p></p> 
      </div> 

      <h:panelGrid columns="2"> 

       <h:outputLabel value="Descrição: " style="margin-left: 100px" /> 
       <h:outputLabel value="Resolução: " style="margin-left: 100px" /> 


       <p:inputTextarea cols="32" rows="5" 
        value="#{Chamados.chamado.descricaoObs}" 
        style="overflow:scroll;margin-left: 100px" /> 



       <p:inputTextarea cols="32" rows="5" 
        value="#{Chamados.chamado.resolucao}" 
        style="overflow:scroll;margin-left: 100px" /> 

      </h:panelGrid> 

      <div class="form_description"> 
       <p></p> 
      </div> 

      <p:commandButton value="Adicionar" 
       actionListener="#{Chamados.cadastraChamado}" /> 

     </h:form> 

     <h:form> 
      <p:commandButton action="#{Chamados.testButtonAction}" imediate="true"/> 
      <p:commandButton 
       actionListener="#{Chamados.testButtonActionListener}" /> 
     </h:form> 

    </p:dialog> 

여기 빈 :

public String testButtonAction() { 
    System.out.println("testButtonAction invoked"); 
    return "anotherPage.xhtml"; 
} 

public void testButtonActionListener(ActionEvent event) { 
    System.out.println("testButtonActionListener invoked"); 
} 

방법이 발생하고 나는 그것이 <p:dialog dynamic="true">을 유지하여 어떻게 해결할 수 있습니까?

+0

[

작업의 중복이 ]에서 작동하지 않음 (http://stackoverflow.com/questions/18958729/pcommandbutton-action-doesnt-work-inside-pdialog) – Ben

답변

0

이 페이지 시도가 : 대화를 왜 네가 잘 모릅니다 ..... : 난 단지 P 외부 을 넣어야 만이 해결 된 내 예를

<h:commandButton value="Aceptar" type="button" onclick="irAConf()" class="art-button"> 
</h:commandButton> 

<p:remoteCommand name="irAConf" 
action="#{configuracionBean.irAConfiguracion}"/>     
관련 문제