具有以下 xhtml 代码:
<h:form id="COTreeForm">
<p:tree value="#{COBean.root}" var="node" id="COTree" dynamic="true" selectionMode="single">
<p:ajax event="select" update="@(.coDetailsPanel)" listener="#{COBean.onNodeSelect}" />
<p:treeNode id="COtreeNode" type="customerOrder" icon="ui-icon-co">
<p:outputPanel id="CO_#{node.key}"> CO: #{node.key} </p:outputPanel>
<!-- <p:draggable for="CO_#{node.key}" helper="clone" /> -->
</p:treeNode>
<p:treeNode id="COItreeNode" type="customerOrderItem">
<p:outputPanel id="COI_#{node.key}" styleClass="ui-tree-node-label-coi"> COI: #{node.key} </p:outputPanel>
<!-- <p:draggable for="COI_#{node.key}" helper="clone" /> -->
</p:treeNode>
</p:tree>
</h:form>
被<p:outputPanel id="CO_#{node.key}"> CO: #{node.key} </p:outputPanel>
评估为以下 HTML 代码:
<span id="COTreeForm:COTree:0:CO_"> CO: customer1_co1 </span>
为什么#{node.key}
id 属性被评估为空字符串?!请注意,它被正确评估为标签内容。