2016-11-21 24 views
1

で働いていないバインディング私はビューで、私が使用するユーザー入力バインドさ属性String idのAJAX呼び出しに基づいていくつかのデータを取得するには、正しくデータビーンは、AJAX呼び出し

<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は、AJAXが置かれている唯一のフィールド(String id)が更新されて実行されます。残りのフィールドはデフォルト値で埋められます。

LOGのTRACE

[21/11/16 17:10:12:508 CET] 0000007a SystemOut O DEBUG [Webコンテナ:0:8610ff45-f4c5-4faf-A370-efa36701bc01] - ContactForm [name =、surnames =、nif = 46713535Y]

なぜこのようなことが起こっているのでしょうか?

+0

例には1つのフィールドしかありません... [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" 
/> 

が、それは他の人に助けを願っています。