タブビューに編集者のグループを表示したい。各エディターには、レンダリングされたエディターを格納するcomponentというプロパティがあります。単純なエディターは HTML タグを使用してエディターをレンダリングしますが、複雑なものは別のページで定義されたエディターを使用します。ツリーの構築時に値が使用できないためeditor.component
、ui:includeでは使用できないことがわかりました。この問題を解決するにはどうすればよいですか? この制限がない ui:include の代替手段はありますか?
<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>
編集1
web.xmlには次のエントリが含まれます。
<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は WEB-INF フォルダー内にあります。
<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 には注釈が付けられています@FacesComponent("ro.custom.DynamicInclude")
groups.xhtmlに、動的 include - の名前空間を追加しましたxmlns:custom="http://www.custom.ro/"
。
EDIT2
最後に、私はそれを機能させることができました。欠けていたのは、handler-class(com.corejsf.tag.DynamicIncludeHandler) のエントリでした。DynamicInclude の getSrc メソッドで src の null をテストした行も削除しました。