I want to display a group of editors in a tabview. Each editor has a property called component, that stores the rendered editor. Simple editors use HTML tags to render the editor, whereas complex ones use editors defined in another pages. I have found out that I cannot use editor.component
with ui:include because the value is not available when the tree is build. How can I solve this issue? Are there any alternatives to ui:include that don't have this limitation?.
<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:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:panelGroup>
<p:tabView value="#{groupsBean.groups}" var="group">
<p:tab title="#{group.name}">
<h:panelGroup>
<p:dataTable value="#{group.editors}" var="editor">
<p:column headerText="Key">
<h:outputText value="#{editor.name}" />
</p:column>
<p:column headerText="Value">
<h:panelGroup rendered="#{not editor.href}">
<h:outputText value="#{editor.component}" escape="false" />
</h:panelGroup>
<h:panelGroup rendered="#{editor.href}">
<ui:include src="#{editor.component}" />
</h:panelGroup>
</p:column>
</p:dataTable>
</h:panelGroup>
</p:tab>
</p:tabView>
</h:panelGroup>
EDIT 1
web.xml contains these entries:
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/springsecurity.taglib.xml; /WEB-INF/custom.taglib.xml</param-value>
</context-param>
custom.taglib.xml is inside WEB-INF folder.
<facelet-taglib>
<namespace>http://www.custom.ro/</namespace>
<tag>
<tag-name>dynamic</tag-name>
<component>
<component-type>ro.custom.DynamicInclude</component-type>
</component>
</tag>
</facelet-taglib>
DynamicInclude is annotated with @FacesComponent("ro.custom.DynamicInclude")
In groups.xhtml I have added the namespace for dynamic include - xmlns:custom="http://www.custom.ro/"
.
EDIT2
Finally I have managed to make it work. The missing thing was the entry for handler-class(com.corejsf.tag.DynamicIncludeHandler). I have also removed the lines that tested the src for null in getSrc method of DynamicInclude.