webtier@glassfish.java.net

Re: [webtier] Programmatic creation of composite components in JSF 2.0

From: Ed Burns <Ed.Burns_at_Sun.COM>
Date: Sun, 05 Apr 2009 23:10:31 +0200

>>>>> On Fri, 03 Apr 2009 10:13:53 -0700, Ryan Lubke <Ryan.Lubke_at_Sun.COM> said:

RL> On 3/31/09 5:50 AM, webtier_at_javadesktop.org wrote:

W> With the cool JSF 2.0 composite component feature coming along, I
W> would like to know if it is possible to programmatically add
W> composite components to the component tree ?

W> I have tried doing this inside a standard component binding i.e.<h:form binding="bb.setComponent"/> with the backing bean containing the following method:

W> Facelet facelet = faceletFactory.getFacelet(compositeComponentResource.getURL());
W> facelet.apply(context.getFacesContext(), facetComponent);

RL> How recent of a build are you using to try this out?

That's not the easiest way to do it. The feature you request was
designed to be used via a call to:

Application.createComponent(FacesContext context, Resource componentResource)

where the second argument is a pointer to an Facelet page resource
within a library. See Application.getResourceHandler() for how to
create a Resource instance.

Ed