2016-11-21 1 views
1

내가 일부 데이터 내가 바인더 제본 속성 String id에보기에서 아약스 호출을 사용하여 사용자의 입력에 따라하려면 제대로 데이터

<var name="contactForm" class="my.package.bean.ContactFormHelper"/> 

를 제출 도우미를 정의하는 흐름이 아약스 호출 작동하지 바인딩 이 방법 :

<h:panelGroup > 
    <p:outputLabel for="id" value="ID" /> 
    <p:inputText id="id" required="true" value="#{contactForm.id}" label="ID"> 
     <f:ajax 
      event="change" 
      listener="#{contactController.identifyCustomer(contactForm)}" 
      render="anotherPanel" 
     /> 
     <p:clientValidator/> 
    </p:inputText> 
    <p:message for="id" /> 
</h:panelGroup> 

그러나 아약스가 배치된다 identifyCustomer에만 필드를 실행할 때 (String id가) 업데이트됩니다. 나머지 필드는 기본값으로 채워집니다.

LOG 추적

[21/11/16 17 : 10 : 12 : 중부 유럽 표준시 05시 08분] 0000007a SystemOut O DEBUG [웹 컨테이너 0 : 8610ff45-f4c5-4faf-A370-efa36701bc01] - ContactForm [이름 =, 성명 = nif = 46713535Y]

왜 이런 일이 발생 했는가?

+0

예제에는 하나의 필드 만 있습니다 ... [mcve] 제발 ('p : ajax'를 시도 했습니까?) – Kukeltje

+2

읽어보기 http://stackoverflow.com/questions/25339056/understanding-primefaces- process-update-and-jsf-fajax-execute-render-attributes는 여러분의 질문에 대한 답변을 생각합니다. – Kukeltje

답변

1

나는 process 쉼표로 구분 @this과 필드를 사용하여 솔루션을 발견했습니다

<p:ajax 
    event="change" 
    listener="#contactController.identifyCustomer(contactForm)}" 
    <!-- add process with the fields to bind --> 
    process="@this name,surname1,surname2" 
    update="newCustomerPanel" 
/> 

가 다른 사람에게 도움을 바랍니다.