我有一個JSP 2.0 <ui:component>
,其中是一個<p:dataTable>
與一列使用複合呈現關於某些內容的特殊邊框。現在我需要確定位於內容中的ajax呈現屬性中的<p:dataTabe>
。如何訪問複合材料的父命名容器?
<ui:component>
<p:dataTable id="dataTable" var="userItem" ... />
<p:column>
<my:borderBox id="borderBox">
<p:commandButton
action="#{userController.doDelete(userItem.id)}"
value="delete"
update="?????"/> <!-- How to address the dateTable? -->
</my:borderBox>
</p:column>
</p:dataTable>
<ui:component>
我BorderBox:
<html xmlns:composite="http://java.sun.com/jsf/composite" ...>
<composite:interface>
<composite:attribute name="styleClass" default="" type="java.lang.String"/>
</composite:interface>
<composite:implementation>
<h:panelGroup ...>
...
<composite:insertChildren/>
</h:panelGroup>
</composite:implementation>
我的想法是使用類似
update=":#{component.namingContainer.parent.namingContainer.clientId}:dateTable
但component.namingContainer.parent
接縫爲空。
當我更換<p:commandButton>
此聲明:
Parent ClientId 1: #{component}
Parent ClientId 2: #{component.namingContainer}
Parent ClientId 3: #{component.namingContainer.clientId}
Parent ClientId 4: #{component.namingContainer.parent}
Parent ClientId 5: #{component.namingContainer.parent.namingContainer}
我得到這樣的輸出:
Parent ClientId 1: [email protected]
Parent ClientId 2: [email protected]
Parent ClientId 3: main_form:profilTabView:dataTable:0:borderBox
Parent ClientId 4:
Parent ClientId 5:
我不知道什麼問題吧:mybey我的想法,以確定完成列表錯誤或有一些錯誤或有更好的方法? (但我不能用固定絕對identifyer爲dateTable!)
版本:Primeface 3.2,鑽嘴魚科2.1.6在Glassfish 3.1.2
不幸的是我不使用'ui:component'標籤,所以我對它不瞭解太多;我通常使用複合組件,您可以從EL表達式中引用父命名容器,如'#{cc.parent.id}'。不過,我認爲'parent'是EL表達式語言中的一個保留變量,所以它應該像'#{parent.id}'一樣簡單,以檢索父命名容器標識符。 –
@maple_shaft:''被複合組件隱式使用。因此,直接聲明而不是''更清晰。 –
BalusC
您正在使用哪個JSF impl /版本和PF版本? – BalusC