webtier@glassfish.java.net

Re: [webtier] JSF2.0 Composite Component with f:param

From: Jim Driscoll <Jim.Driscoll_at_Sun.COM>
Date: Wed, 07 Jan 2009 09:21:49 -0800

Hi Lincoln -

Out of curiosity, why does it have to be a parameter, and not an
attribute? (This is completely separate from the question of whether it
should work or not, I'm just curious for the use case.)

So, instead of
<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>

You would say:
<ocp:link value="#{myBean.getMappingId}" param="${myBean.name}" >
My Link Text
</ocp:link>

Jim

Lincoln Baxter, III wrote:
> 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>
>