webtier@glassfish.java.net

Re: [webtier] JSF Latest Snapshot, issue with Component Tree

From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
Date: Sat, 21 Mar 2009 10:41:43 -0400

Ok, I can reproduce this now... take a look at the composite component
below.

By deleting the <h:outputScript> tag, I am able to get proper rendering.

This is a layout component, and is used in several places in the page...
I'm guessing that when the <h:outputScript> component repeats, it is
always adding itself to the HEAD component again, but not assigning
itself a unique ID.



<!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:ui="http://java.sun.com/jsf/facelets"
        xmlns:composite="http://java.sun.com/jsf/composite">

<composite:interface>
        <composite:renderUsingPageChildren />
        <composite:attribute name="value" required="true" type="String" />
        <composite:attribute name="collapsible" required="false" type="Boolean"
                default="false" />
        <composite:facet name="content" />
</composite:interface>

<composite:implementation>
        <h:outputScript name="ocpcommon/headerTab.js" target="head" />
        <h:panelGroup styleClass="OCPheaderTab" layout="block">
                <div class="OCPtab">
                <h3><h:outputText value="#{compositeComponent.attrs.value}" /></h3>
                <div class="OCPtabAction"><composite:renderUsingPageChildren />
                <h:panelGroup layout="block"
                        style="float: right; position:relative; top:-18px; left: -3px;">
                        <h:panelGroup layout="inline"
                                rendered="#{compositeComponent.attrs.collapsible eq 'true'}">
                                <h:outputLink id="collapse" href=""
                                        onclick="return collapse(event, '#{compositeComponent.clientId}');"
                                        title="Collapse">
                                        <h:graphicImage url="/images/stock/up_2.gif" />
                                </h:outputLink>
                                <h:outputLink id="expand" href="#" style="display:none;"
                                        onclick="return expand(event, '#{compositeComponent.clientId}');"
                                        title="Expand">
                                        <h:graphicImage url="/images/stock/down_2.gif" />
                                </h:outputLink>
                        </h:panelGroup>
                </h:panelGroup></div>
                </div>

                <h:panelGroup id="content" styleClass="OCPcontent" layout="block"
                        rendered="#{!empty compositeComponent.facets.content}">
                        <composite:insertFacet name="content" />
                </h:panelGroup>
                <div class="clearing"></div>
        </h:panelGroup>
</composite:implementation>

</html>