1

我有一个使用OmniFaces 2.6.8的项目。在这个项目中,我有一些使用 OmniFaces 的facelets 标记文件<o:tagAttribute>。对于我的一些标记文件,我注意到了奇怪的行为,这意味着<o:tagAttribute>似乎没有工作,我得到了

IllegalStateException: Duplicate component ID 'myForm:outer' found in view.

结果,因为id我的外部标签的 - 属性没有被清除,因此在内部标签中被重用(正如 OmniFaces 的展示案例中所展示的那样)。

我可以用两个非常简单的标签文件重现这个问题。这是我首先使用这些标记文件的方法:

<h:form id="myForm">
  <my:outer id="outer">
    <my:inner />
  </my:outer>
</h:form>

这是标记文件的完整代码。

外部.xhtml:

<ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:o="http://omnifaces.org/ui">

  <o:tagAttribute name="id" />

  <h:panelGroup id="#{id}">
    <ui:insert/>
  </h:panelGroup>

</ui:composition>

内部.xhtml:

<ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:o="http://omnifaces.org/ui">

  <o:tagAttribute name="id" />

  <h:inputText id="#{id}">
    <ui:insert/>
  </h:inputText>

</ui:composition>

我注意到,只要我更改inner.xhtml为使用<h:outputText>而不是<h:inputText>. 当我将value-attribute 添加到<h:inputText>.

这是 OmniFaces 中的错误,还是我做错了什么?
更新:我在 OmniFaces bugtracker 中创建了一个问题。)

我的环境

  • OmniFaces 2.6.8
  • 莫哈拉 2.2.15
  • Wildfly 10.1.0.Final
4

1 回答 1

2

这是 OmniFaces 2.6.8 中的一个错误,在 OmniFaces 2.6.9 中已修复(但未在更改日志中提及)。交换 OmniFaces 的依赖版本足以解决所描述的问题。

更新:请注意,还有一个相关问题,应在 2.7 中修复(在撰写本文时,2.7 尚未发布)。

于 2018-07-23T07:39:09.950 回答