On 8/4/05, Matthias Marschall <[EMAIL PROTECTED]> wrote:
> 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 ;-) )
You're right ... and you really don't want to go there ....
>
> example:
> writer.write("<ng:myCustomTag ...>");
>
> I fear we really have to create a JSF component out of our custom tag.
>
Well, that *is* why we have a component API, isn't it? :-)
> Matthias
>
Craig