2

由于性能问题,我正在将一些复合材料迁移到自定义标签。使用复合材料时,所有 ID 均已正确生成,但在使用自定义标签时,我遇到了重复的 Id 异常,即使我创建了自定义 EL 表达式来生成新 ID。

经过一番研究,似乎是因为在嵌套标签时继承了标签属性:

<far:fcontainer name="**father1**" type="panel">
 <far:fcontainer type="panel">
  <far:fcontainer type="panel">child 3</farTag:fcontainer>
 </far:fcontainer>
</far:fcontainer>

在示例中,第一个 fcontainer 应该有 id father1,嵌套的应该有生成的 ID,但这就是我所拥有的:

<div id="**father1**" class="ui-widget-content">
 <div id="**father1**" class="ui-widget-content">
  <div id="**father1**" class="ui-widget-content">child3</div>
 </div>
</div>

自定义标签是:

<ui:composition>
    <p:outputPanel layout="block" styleClass="#{type == 'panel'?'ui-widget-content':''}" 
         id="#{empty name ? far:generateId() : name}">
        <ui:insert />
    </p:outputPanel>
<ui:composition>

这是正常的吗?有什么解决方法吗?

在 Mojarra 2.1.26 上测试。

提前致谢。

更新:在 MyFaces 2.1.12 上测试,似乎工作正常,Mojarra 的错误?

4

1 回答 1

0

解决此错误的方法是始终使用自定义 EL 表达式,在其中您可以首先检查父组件是否具有属性集。

于 2014-01-28T11:49:57.370 回答