You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Vincent Sevel <vs...@sqli.com> on 2005/03/24 18:38:56 UTC

RE : Custom Components with child-components

Any way we could delegate the construction of the children component
tree to a JSP rather than building the tree programmatically?

Something like :
	myComponent.getChildren().add(process("/myComponentBody.jsp"))

Allowing a mapping between pseudo-beans used in this JSP (like foo in
#{fooBean.bar}) and real beans that would be used by the client of our
component would also add a great deal of flexibility to our component
(kind of like myfaces aliasBean):

<!-- client.jsp -->
<myComponent fooBean="#{myRealBean}"/>

---------------------------

<!-- myComponentBody.jsp -->
<h:inputText value="#{fooBean.bar}"/>

This would greatly simplify development of reusable panels.

Vince

-----Message d'origine-----
De : Craig McClanahan [mailto:craigmcc@gmail.com] 
Envoyé : jeudi, 24. mars 2005 16:52
À : MyFaces Discussion
Objet : Re: Custom Components with child-components

Option b is definitely the correct answer.  To add a child:

    myComponent.getChildren().add(childComponent);

Craig



On Thu, 24 Mar 2005 10:58:01 +0100, Jesse Alexander (KBSA 21)
<al...@credit-suisse.com> wrote:
> I have to create custom components that contain child components.
> Eg:
>  a layout component that will contain some HtmlCommandLink components
> 
> I think basically I have two choices:
> a) do all the rendering myself
> b) instantiate the child components and let them do their own
rendering
> 
> a) has several bad smells ;-)
> 
> b) is my preferred way. But
> 
> When I add a HtmlCommandLink to a JSP-page I use the h:commandLink tag
and
> usually embed to other tags within: the f:param and the h:outputText.
> How can I do this in my custom-component?  So far I have not found a
method
> like: "xyz.addChild(UiComponent)" or similar.
> 
> Has somebody already gone that way or has somebody an idea about it?
> 
> thanks
> Alexander
>