2011-10-19 29 views
2

最好的方式來說明我想要做的只是舉個例子:在JSF 2 - 嘗試重新解析panelGroup中是2 UI之間:重複

<h:form prependid="false" > 
    <h:panelGroup id="layer1"> 
     <ui:repeat> 
      <h:panelGroup id="layer2> 
       <ui:repeat> 
        <h:panelGroup id="layer3"> 
         <h:commandButton> 
          <f:ajax render="layer2" execute="@form" /> 
         </h:commandButton> 
        </h:panelGroup> 
       </ui:repeat> 
      </h:panelGroup> 
     </ui:repeat> 
    </h:panelGroup> 
</h:form> 

當按下中的h:commandButton上面的例子我從JSF得到一個異常,說ID layer2不存在。

我該如何正確地做到這一點?

謝謝!

回答

2

以下應制定出這一點:

<f:ajax render=":#{component.parent.parent.parent.parent.clientId}:layer2" execute="@form" /> 

它工作在MyFaces的唯一,而不是在鑽嘴魚科(還)。它的<ui:repeat>在很多方面都被打破了。

+0

非常感謝! (使用MyFaces)我希望有一個更「簡化」的方式來做到這一點.. – Ben

+0

我也是。請注意,'render =「:#{component.parent.parent.parent.clientId}」'應該在理論上起作用,但它不適用。另外,''h:panelGroup binding =「#{layer2}」>'with'render =「:#{layer2.clientId}」'理論上應該可以工作,但它不會。這兩種方法都適用於MyFaces/Mojarra,當「」未出現時。所以它在MyFaces中可能也是一個*位*碎片。 – BalusC