webtier@glassfish.java.net

JSF 2 adding a composite components to the view from a managed bean?

From: <webtier_at_javadesktop.org>
Date: Thu, 02 Jul 2009 17:51:05 PDT

Is it possible to programatically add a composite component (defined in a xhtml file) to the view ?

So I have a custom component defined in resources/components/mycomponent.xhtml

[code]
...
<cc:interface name="mycomponent">
  <cc:attribute name="foo"/>
</cc:interface>
<cc:implementation>
  <h:outputText value="#{cc.attrs.foo}"/>
</cc:implementation>
...
[/code]

And I would like to add it to a view programatically from a managed bean using something like:

[code]
...
UIComponent composite = app.createComponent(context,"components/mycomponent.xhtml");
composite.getAttributes().put("foo","bar");
context.findComponent("form").getChildren().add(composite);
...
[/code]

Is this possible?
[Message sent by forum member 'janderssn' (janderssn)]

http://forums.java.net/jive/thread.jspa?messageID=354028