爲了獲得數據表的行號,我在這裏得到了一個答案,我可以將dataTable直接綁定到視圖(JSF 2 dataTable row index without dataModel)。將多個JSF數據表綁定到查看
我在複合組件中使用該函數,並且可能在同一頁中有幾個。我相信綁定使得不可能在每個頁面上使用多個組件;是否有可能以某種方式「分開」綁定每個表?
爲了獲得數據表的行號,我在這裏得到了一個答案,我可以將dataTable直接綁定到視圖(JSF 2 dataTable row index without dataModel)。將多個JSF數據表綁定到查看
我在複合組件中使用該函數,並且可能在同一頁中有幾個。我相信綁定使得不可能在每個頁面上使用多個組件;是否有可能以某種方式「分開」綁定每個表?
使用UIData
屬性創建支持組件類。
@FacesComponent("fooComponent")
public class FooComponent extends UINamingContainer {
private UIData table;
// +getter +setter
}
並將其綁定到#{cc.table}
代替(該#{cc}
指當前背襯組件實例)。
<cc:interface componentType="fooComponent">
...
</cc:interface>
<cc:implementation>
<h:dataTable binding="#{cc.table}" ...>
<h:column>#{cc.table.rowIndex + 1}</h:column>
...
</h:dataTable>
</cc:implementation>
那麼你會綁定每個表上不同的託管bean,或不同的屬性的支持bean?爲什麼會是這個問題? – partlov