2017-02-01 2 views
1

JSF에서 일부 데이터를 제출하려고합니다. 문제는 두 가지 폼이 있고 업데이트를 트리거 할 버튼이 폼 외부에 있다는 것입니다. 여기서 내 코드를 삽입하면 내가 의미하는 바를 더 잘 이해할 수 있습니다. 그 때문에 서버에 데이터를 제출할 수 없습니다.JSF 업데이트 양식

<ui:define name="mainArea"> 
    <h:form id="form"> 
     <div class="row"> 
      <div class="col-md-5"> 
       <p:outputLabel for="rfqName" value="Name" /> 
       <br></br> 
       <p:inputText id="rfqName" required="true" style="width:100%;" 
        value="#{data.data.rfqName}" maxlength="100"> 
        <p:ajax event="change" update="@form"/> 
        </p:inputText> 
      </div> 
     </div> 
     <div class="row"> 
      <div class="col-md-3"> 
       <p:outputLabel for="rfqVersion" value="Version" /> 
       <br></br> 
       <p:inputText id="rfqVersion" required="true" style="width:60%;" 
        value="#{data.data.rfqVersion}" maxlength="20"></p:inputText> 
      </div> 
     </div> 
    </h:form> 

</ui:define> 

<ui:define name="actionSection"> 
    <p:commandButton actionListener="#{logic.close}" value="Proceed" update=":form" 
     styleClass="pull-right"> 

     </p:commandButton> 

    <p:commandButton value="Save" styleClass="pull-right" /> 
</ui:define> 

답변

0

primeface RemoteCommand를 사용할 수 있습니다. 이렇게하면 양식의 단추를 외부에서 클릭 할 수 있습니다.

<ui:define name="mainArea"> 
    <h:form id="form"> 
     <div class="row"> 
      <div class="col-md-5"> 
       <p:outputLabel for="rfqName" value="Name" /> 
       <br></br> 
       <p:inputText id="rfqName" required="true" style="width:100%;" 
        value="#{data.data.rfqName}" maxlength="100"> 
        <p:ajax event="change" update="@form" /> 
       </p:inputText> 
      </div> 
     </div> 
     <div class="row"> 
      <div class="col-md-3"> 
       <p:outputLabel for="rfqVersion" value="Version" /> 
       <br></br> 
       <p:inputText id="rfqVersion" required="true" style="width:60%;" 
        value="#{data.data.rfqVersion}" maxlength="20"></p:inputText> 
      </div> 
     </div> 
     <p:remoteCommand name="remoteClose" actionListener="#{logic.close}" 
      update=":form" styleClass="pull-right" /> 
     <p:remoteCommand name="remoteSave" value="Save" 
      styleClass="pull-right" /> 
    </h:form> 

</ui:define> 

<ui:define name="actionSection"> 
    <p:commandButton type="button" onclick="remoteClose()" value="Proceed" /> 
    <p:commandButton type="button" onclick="remoteSave()" value="Save" 
     styleClass="pull-right" /> 
</ui:define> 
+0

감사합니다. 이 하나가 완벽하게 작동합니다. –

+0

여러분을 환영합니다! – jklee