2011-09-03 71 views
0

我有一个JSF 2.0页以下:<f:ajax>第二次运行时不更新模型值?

<rich:column styleClass="tbl-weight" id="weight"> 
         <f:facet name="header"> 
          <h:outputText value="Weight" /> 
         </f:facet> 

         <h:outputLabel value="lbs" for="lbs" /> 
         <h:inputText size="3" id="lbs" label="lbs" 
          validatorMessage="Lbs must be from 0 to 999" 
          value="#{weighFamilyBacking.weightDecoratorMap[child].lbs}"> 
          <f:validateLongRange minimum="0" maximum="999" /> 
          <f:ajax event="change" render="@form" immediate="true"/> 
         </h:inputText> 

         <h:outputLabel value="oz" for="oz" /> 
         <h:inputText size="3" id="oz" label="oz" 
          validatorMessage="Oz must be from 1 to 15" 
          value="#{weighFamilyBacking.weightDecoratorMap[child].oz}"> 
          <f:validateLongRange minimum="0" maximum="15" /> 
          <f:ajax event="change" render="currentPayoutOutput" /> 
         </h:inputText> 

         <h:message styleClass="error" for="lbs" /> 
         <h:message styleClass="error" for="oz" /> 
        </rich:column> 


        <rich:column styleClass="tbl-payout" id="currentPayout"> 
         <f:facet name="header"> 
          <h:outputText id="payout" value="Payout" /> 
         </f:facet> 
         <h:outputText id="currentPayoutOutput" 
          value="#{weighFamilyBacking.weightDecoratorMap[child].payout}" /> 
        </rich:column> 

当看着这个F:AJAX的“磅”和“盎司”投入应更新设置它们的值,然后导致currentPayoutOutput呈现。这只适用于对输入字段的第一次更改。

如果使用@form或者我使用currentPayoutOutput,这是相同的结果。使用阶段侦听器,我发现它从processValidations跳转到renderResponse。没有任何验证器消息正在显示。

回答

1

的问题结束了以下内容:

<f:metadata> 
    <f:viewParam name="familyId" value="#{weighFamilyBacking.familyId}" required="true"></f:viewParam> 
    <f:event type="preRenderView" 
     listener="#{weighFamilyBacking.loadFamily}" /> 
</f:metadata> 

本页面需要FAMILYID作为一个参数,它被指定为需要。一旦我删除这些东西按预期工作。我认为,因为参数在那里最初是第一次。然后在随后的帖子中,familyId参数不再存在(因为它不是一个隐藏的表单字段),因此我从验证权跳到呈现阶段,因为验证所需的“viewParam”失败。

相关问题