ID de composant de formulaire:composite:j_id2 a déjà été trouvé dans la vue

/test.xhtml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:composite="http://java.sun.com/jsf/composite/components">
    <f:view>

        <h:head>
            <title>Default Title</title>
        </h:head>

        <h:body>
            <h:form id="form">
                <composite:test id="composite"/>
            </h:form>
        </h:body>

    </f:view>

</html>

/resources/components/test.xhtml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html 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:cc="http://java.sun.com/jsf/composite"
      xmlns:composite="http://java.sun.com/jsf/composite/components"
      xmlns:p="http://primefaces.org/ui">

    <head>
        <title>(For validation only)</title>
    </head>

    <body>
    <cc:interface>
    </cc:interface>

    <cc:implementation>

        <p:panel header="header foo bar">

            <p:panel>
                <f:facet name="header">
                    <h:outputText value="foo"/>

                    <h:outputText value="bar"/>
                </f:facet>
            </p:panel>

        </p:panel>

    </cc:implementation>

</body>

</html>

Cette combinaison donne:

GRAVE: Error Rendering View[/test.xhtml]
java.lang.IllegalStateException: Component ID form:composite:j_id2 has already been found in the view.  

avec cet arbre:

GRAVE: JSF1007: Duplicate component ID form:composite:j_id2 found in view.
GRAVE: +id: j_id1
type: javax.faces.component.[email protected]
+id: javax_faces_location_HEAD
type: com.sun.faces.component.[email protected]
+id: j_id3
type: javax.faces.component.[email protected]
+id: j_id4
type: javax.faces.component.[email protected]
+id: j_id5
type: javax.faces.component.[email protected]
+id: j_id6
type: javax.faces.component.[email protected]
+id: j_id7
type: javax.faces.component.[email protected]
+id: j_id8
type: javax.faces.component.[email protected]
+id: j_idt37
type: <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+id: j_idt38
type: <html xmlns="http://www.w3.org/1999/xhtml">
+id: j_idt39
type: javax.faces.component.[email protected]
+id: j_idt40
type: 
<title>Default Title</title>
+id: j_idt55
type: javax.faces.component.[email protected]
+id: form
type: javax.faces.component.html.[email protected]
+id: composite
type: javax.faces.component.[email protected]
+id: j_id2
type: javax.faces.component.[email protected]
+id: j_idt52
type: org.primefaces.component.panel.[email protected]
+id: j_idt53
type: org.primefaces.component.panel.[email protected]
+id: j_id2
type: javax.faces.component.[email protected]
+id: j_idt50
type: javax.faces.component.html.[email protected]
+id: j_idt54
type: javax.faces.component.html.[email protected]
+id: j_idt47
type: 
</html>

Cependant, si je change composite composante de cette façon:

/resources/components/test.xhtml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html 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:cc="http://java.sun.com/jsf/composite"
xmlns:composite="http://java.sun.com/jsf/composite/components"
xmlns:p="http://primefaces.org/ui">
<head>
<title>(For validation only)</title>
</head>
<body>
<cc:interface>
</cc:interface>
<cc:implementation>
<p:panel header="header foo bar">
<p:panel>
<f:facet name="header">
<h:panelGroup>
<h:outputText value="foo"/>
<h:outputText value="bar"/>
</h:panelGroup>
</f:facet>
</p:panel>
</p:panel>
</cc:implementation>
</body>
</html>

L'ajout d'un <h:panelGroup> dans <f:facet> résout le problème.
Mauvais arbre d'indexation ou ai-je raté quelque chose? Je suis en utilisant mojarra 2.1.3 et PrimeFaces 3.0.M4-INSTANTANÉ sous Glassfish 3.1.1.

Je suis face même genre de problème maintenant et voudrais vraiment l'apprécier quelques informations sur ce qui est exactement à l'origine du problème.

OriginalL'auteur Michele Mariotti | 2011-11-13