JSF嵌套ui:insert - 已找到组件ID

时间:2013-03-06 15:21:17

标签: templates jsf primefaces facelets

我的模板结构

layout.xhtml

<html xmlns="http://www.w3.org/1999/xhtml"
     xmlns:f="http://java.sun.com/jsf/core"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:p="http://primefaces.org/ui">
...
<h:form id="headerForm" />
...
<ui:insert name="content">Put default content here, if any.</ui:insert>
...

integration.xhtml

<ui:composition template="/WEB-INF/templates/layout.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:c="http://java.sun.com/jstl/core">
<ui:define name="content">
...
<ui:insert name="tabContent">Tab content</ui:insert>
...
</ui:define>

customerSide.xhtml

<ui:composition template="/pages/protected/integration/integration.xhtml" 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">
<ui:define name="tabContent">
...
</ui:define>
</ui:composition>

当我转到页面http://localhost:8080/dcc/pages/protected/integration/customerSide.xhtml时 我得到了这个例外

java.lang.IllegalStateException: Component ID headerForm has already been found in the view.

headerForm没有问题。如果我删除它将在下一个具有id的组件上失败。 如何在不收到错误的情况下嵌套这些模板?

0 个答案:

没有答案