ui:在tabview中包含另一个ui:include

时间:2013-08-16 14:54:39

标签: jsf include facelets tabview

使用Tomcat 7.0.34,Primefaces 3.5和mojarra 2.1.25 我有以下文件“client.xhtml”:

  <ui:composition template="/templates/Template.xhtml"
  xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
  xmlns:ui="http://java.sun.com/jsf/facelets">
  <ui:define name="template_conteudo">
  <h:form id="formDadosCliente">
  <ui:include src="/client.inc"/>
  </h:form>
  </ui:define>
  </ui:composition>

文件client.inc(这是一个普通的xhtml,并在几个xhtml文件中使用)如下:(简化)

<ui:fragment xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
             xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:p="http://primefaces.org/ui">    
    <p:tabView>
        <p:tab title="Client Info">
            // Client info stuff
        </p:tab>

        <ui:include src="clientBilling.inc"/>
    </p:tabView>
</ui:fragment>

和“clientBilling.inc”:(我在其他几个xhtml文件中使用)

<p:tab title="other tab">
</p:tab>

<p:tab title="another tab">
</p:tab>

“clientBilling.inc”中的标签未显示,但如果我将其从p:tabView中删除,则会显示内容。

1 个答案:

答案 0 :(得分:2)

这个老问题没有回答,我想尝试...

我在clientBilling.inc中添加几行时可以正常工作:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:p="http://primefaces.org/ui">

  <p:tab title="other tab">
  </p:tab>

  <p:tab title="another tab">
  </p:tab>

</ui:composition>
相关问题