webtier@glassfish.java.net

Re: [webtier] JSF2 <renderUsingPageChildren> not passing SelectOneMenu items

From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
Date: Sat, 11 Apr 2009 12:40:44 -0400

Gotcha, thanks.

On Sat, 2009-04-11 at 09:16 -0700, Ryan Lubke wrote:

> This is the correct behavior. The 'renderUsingPageChildren' renders
> the output of a component in
> the location referenced by that tag. If the children being referenced
> don't have renderers (as selectItems
> do not), then no output will be produced.
>
> Currently, and this may change in time for 2.0, there is no way to
> re-locate children of a composite
> component to a location within the composite component implementation.
>
> For you use case, you'd have to pass in the items, variable name,
> label, and value as attributes
> on the composite component itself and pass them through to
> f:selectItems within the composite
> implementation.
>
> On 4/11/09 8:29 AM, Lincoln Baxter, III wrote:
>
> > The list is empty:
> >
> > Client code:
> > <ocp:inputOutputSelectOneMenu id="status" value="#{viewBean.status}"
> > editable="#{authorizationBean.isMember}">
> > <f:selectItems value="#{viewBean.taskStatuses}"
> > var="status" itemLabel="#{status.status}" itemValue="#{status}" />
> > <f:valueChangeListener for="value"
> > binding="#{homeBean.changeStatusListener}" />
> > </ocp:inputOutputSelectOneMenu>
> >
> >
> > Component code:
> >
> > <composite:interface>
> > <composite:attribute name="value" required="true" />
> > <composite:attribute name="editable" default="true" />
> > <composite:attribute name="size" />
> > <composite:editableValueHolder name="value" targets="valueInput" />
> > <composite:renderUsingPageChildren />
> > </composite:interface>
> >
> > <composite:implementation>
> > <h:outputText value="#{compositeComponent.attrs.value}"
> > rendered="#{compositeComponent.attrs.editable eq 'false'}" />
> > <h:selectOneMenu id="valueInput"
> > value="#{compositeComponent.attrs.value}"
> > size="#{compositeComponent.attrs.size}"
> > rendered="#{compositeComponent.attrs.editable ne 'false'}">
> > <composite:renderUsingPageChildren />
> > </h:selectOneMenu>
> > </composite:implementation>
>
>