webtier@glassfish.java.net

JSF2.0 Composite Component with f:param

From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
Date: Tue, 06 Jan 2009 21:57:23 -0500

Hi all,

I'm attempting to create an EZComp composite:component that takes
multiple <f:param value=""/> tags and passes them to a sub-element, but
it seems like all children are encased within a UIOutput component, thus
f:param tag is not available as a child of the EZComp component itself,
and my renderer class is not getting the values it needs.


        <ocp:link value="#{myBean.getMappingId}">
                <f:param value="${myBean.name}" /> <!-- This param never makes
        it to where it needs to go -->
                My Link Text
        </ocp:link>


Is there any way to pass a parameter directly through the component so
that the internals receive the parameter? <f:facet> instead of
<composite:insertChildren /> does not seem to work either, and would end
up cluttering my interface. I just want a straight passthrough like the
original <ui:insert /> behaved in facelets. Anything like it?

Thanks,

Here is my component:


        <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:pretty="http://ocpsoft.com/prettyfaces"
                xmlns:composite="http://java.sun.com/jsf/composite">
        
        <composite:interface>
                <composite:attribute name="value" required="true" />
                <composite:attribute name="type" default="mapping" />
                <composite:attribute name="rendered" default="true" />
        </composite:interface>
        
        <composite:implementation>
                <f:subview id="linkGroup"
                        rendered="#{compositeComponent.attrs.rendered ne 'false'}">
                        <pretty:link mappingId="#{compositeComponent.attrs.value}"
                                rendered="#{compositeComponent.attrs.type eq 'mapping' ||
        empty compositeComponent.attrs.type}">
                                <composite:insertChildren /> <!-- This is where the param
        needs to go -->
                        </pretty:link>
                        <h:outputLink value="#{compositeComponent.attrs.value}"
                                rendered="#{compositeComponent.attrs.type eq 'url'}">
                                <composite:insertChildren />
                        </h:outputLink>
                </f:subview>
        </composite:implementation>
        
        </html>