brevleq
brevleq

Reputation: 2141

How create a composite component that isn't a NamingContainer

I've create a composite component to substitute primefaces popup in my project. I've found something really bad in the generated html, an strange id appears and I can't find where this id is beggining, so I suspect this id is generated by composite component. I need remove this id to refresh just the content I need... So, is there a way I can disable this component generate this id??

for ilustration:

<c:interface>
    <c:attribute name="titulo" default="sem titulo" required="false" />
    <c:attribute name="renderizar" default="false" required="false" />
    <c:facet name="conteudo" />
</c:interface>

<c:implementation>
    <h:outputStylesheet library="css" name="hrgiPopup.css" target="head" />
    <h:outputStylesheet library="css" name="clearfix.css" target="head" />
    <h:outputScript library="js" name="hrgiPopup.js" target="head" />
    <h:panelGroup layout="block" rendered="#{cc.attrs.renderizar}"
    class="hrgi-dialog-panel clearfix">
    <h:panelGroup layout="block" class="hrgi-dialog-overlay clearfix"></h:panelGroup>
    <h:panelGroup layout="block" class="hrgi-dialog-box clearfix">
        <h:panelGroup layout="block" class="hrgi-dialog-title clearfix">
            <h:outputLabel style="float:left" value="#{cc.attrs.titulo}" />
        </h:panelGroup>
        <h:panelGroup layout="block" class="hrgi-dialog-background clearfix">
            <h:panelGroup layout="block" class="hrgi-dialog-content clearfix">
                <c:renderFacet name="conteudo" required="true" />
            </h:panelGroup>
        </h:panelGroup>
    </h:panelGroup>
</h:panelGroup>

Upvotes: 1

Views: 1303

Answers (1)

BalusC
BalusC

Reputation: 1109362

Just give the composite component a fixed id so that JSF won't autogenerate it.

<hrgi:dialog id="foo" />

No, you can't disable it. It would otherwise not be possible to use multiple composite components in the same view. An alternative is to use a Facelets tag file instead. But this doesn't allow for fine grained declaration and nicer definition of attributes, actions, facets, etcetera.

Upvotes: 1

Related Questions