【问题标题】:OmniFaces <o:tagAttribute> not working under some circumstancesOmniFaces <o:tagAttribute> 在某些情况下不起作用
【发布时间】:2018-12-17 06:36:36
【问题描述】:

我有一个使用OmniFaces 2.6.8 的项目。在这个项目中,我有一些 facelets tag files,它们使用 OmniFaces 的 &lt;o:tagAttribute&gt;。对于我的一些标记文件,我注意到奇怪的行为,这意味着&lt;o:tagAttribute&gt; 似乎不起作用,我得到了

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>

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

outer.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>

inner.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 更改为使用&lt;h:outputText&gt; 而不是&lt;h:inputText&gt;,就不会出现问题。当我将value-attribute 添加到&lt;h:inputText&gt; 时,它也会消失。

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

我的环境

  • OmniFaces 2.6.8
  • Mojarra 2.2.15
  • Wildfly 10.1.0.Final

【问题讨论】:

    标签: omnifaces tagfile


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-11-28
      • 2011-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-29
      • 1970-01-01
      相关资源
      最近更新 更多