Craig McClanahan wrote:
If you want to dynamically compose child components, why not just add
them to the component tree programmatically?
Assume you have an outer component to which you want to dynamically
add a form with a bunch of fields, where you don't know which ones
you'll need ahead of time. Something like this will work:
OuterComponent outer = ...; // Get reference to the component that
will be the parent
HtmlForm form = new HtmlForm();
form.setId("form1");
form.setXxx(...); // Set other properties
outer.getChildren().add(form);
; // Do the same thing adding children to the form
When you're through, the components you just created can render
themselves. The only tricky detail to remember is that the outer
component has to return true for the rendersChildren property.
Yes, building the component tree works if I want to add JSF components
only. My example was misleading in the case that it showed I want to use
JSF component. In fact we would have to use a custom JSP tag instead. I
fear there is really no way of doing that in a reasonable way (means
without jspc ;-) )
example:
writer.write("<ng:myCustomTag ...>");
I fear we really have to create a JSF component out of our custom tag.
Matthias