Jsf 嵌套insertChildren复合

Jsf 嵌套insertChildren复合,jsf,composite-component,Jsf,Composite Component,我有两个嵌套组合 复合A <?xml version="1.0" encoding="ISO-8859-1"?> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"

我有两个嵌套组合

复合A

<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"
    xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://sig.com/faces"
    xmlns:composite="http://java.sun.com/jsf/composite">

    <composite:interface>
    </composite:interface>
    <composite:implementation>
        <composite:insertChildren />
        <p:separator />
    </composite:implementation>
</ui:composition>
但案例2对我没什么帮助。我需要它就像案例2一样

有什么帮助吗


谢谢你

我和你一样有同样的问题

我有一个组件a.xhtml


这在三个文件中使用:

  • common/approve.xhtml
  • identity/technical/search.xhtml
  • identity/business/search.xhtml
在“identity/*/search.xhtml”页面中,我为组件A提供了许多标识属性和子级。 因为这会产生大量重复的代码,所以我尝试为两个标识页创建组件A的子组件s

identity_A.xhtml


我注意到,我给identity_A.xhtml的子项不再显示在primefaces数据表中。

我的解决方案/解决方法是为这两个页面创建模板,而不是子组件:

identitySearch.xhtml

。。。
...
也许你可以像我那样解决你的问题。 我希望会有一个解决方案,在嵌套的复合组件中使用
composite:insertChildren

<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"
    xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://sig.com/faces"
    xmlns:mycomposites="http://java.sun.com/jsf/composite/mycomposites"
    xmlns:composite="http://java.sun.com/jsf/composite">

    <composite:interface>
    </composite:interface>
    <composite:implementation>
        <mycomposites:a>
            <composite:insertChildren />
        </mycomposites:a>
    </composite:implementation>

</ui:composition>
<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"
    xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://sig.com/faces"
    xmlns:gt="http://java.sun.com/jsf/composite/template"
    xmlns:mycomposites="http://java.sun.com/jsf/composite/mycomposites"
    template="/template/template.xhtml">

    <ui:define name="body">
        <mycomposites:b>
            <h:outputText value="test" />
        </mycomposites:b>
    </ui:define>

</ui:composition>
<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"
    xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://sig.com/faces"
    xmlns:mycomposites="http://java.sun.com/jsf/composite/mycomposites"
    xmlns:composite="http://java.sun.com/jsf/composite">

    <composite:interface>
    </composite:interface>
    <composite:implementation>
        <mycomposites:desktop>
            <!-- MOVED -->
        </mycomposites:desktop>
        <composite:insertChildren />
    </composite:implementation>
</ui:composition>
<composite:implementation>
  <primefaces:datatable>
    <primefaces:column>
      <h:outputText value="#{row.identityName}" />
    </primefaces:column>
    <composite:insertChildren />
  </primefaces:datatable>
</composite:implementation>
<composite:implementation>
  <component:A identityAttribute="example">
    <primefaces:column>
      <h:outputText value="#{row.identityName}" />
    </primefaces:column>
    <composite:insertChildren />
  </component:A>
</composite:implementation>
...
<component:A identityAttribute="example">
  <primefaces:column>
    <h:outputText value="#{row.identityName}" />
  </primefaces:column>
  <ui:insert name="datatableChildren">
</component:A>
...