Well,

for very easy situations, it is ok to create it in the getter, when it
is sure that your component will not change during the life-time of a
view.

For all other things, it is much better to provide a setter and
initialize the component somewhere else so that you can dynamically
change the component and what it binds to.

regards,

Martin


On 11/4/05, Enrique Medina <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  Recently I posted a similar question and got the answer from Mike
> Kienenberger about not using the getter of the binded property to create it,
> as I can have it already created from the JSF engine in my setter method.
>
>  Now I see that Martin proposes to create it in the getter.
>
>  But should be the best approach then?
>
>
> 2005/11/4, Martin Marinschek <[EMAIL PROTECTED]>:
> > What you want to do is do a binding for panelGroup
> >
> > and then add children to this panelGroup - with this you can create
> > extra components.
> >
> > code snippet (not compiled except in my head ;):
> >
> > public UIComponent getPanelGroup()
> > {
> > HtmlPanelGroup panelGroup = new HtmlPanelGroup();
> > panelGroup.getChildren().add(new HtmlInputText());
> > panelGroup.getChildren().add(new HtmlOutputText());
> > ...
> >
> > return panelGroup;
> > }
> >
> > regards,
> >
> > Martin
> >
> > On 11/4/05, Nikita Koselev <[EMAIL PROTECTED]> wrote:
> > > Can you explain your task better, please.
> > >
> > > Nikita
> > >
> > > On 04/11/05, Rene Ott < [EMAIL PROTECTED]> wrote:
> > > > Hello @all,
> > > >
> > > > I would like to create dynamically inside a backing bean some
> components.
> > > > Looking around in the net I found only solutions that create a binding
> to a
> > > > component, for example:
> > > >
> > > > <h:panelGroup binding="#{my.backingbean}">
> > > > ...
> > > >
> > > > This means that I always need an existing component like panelGroup
> for
> > > > creating with a binding some components.
> > > >
> > > > How can I create dynamically components without using a binding (and
> in the
> > > > end an extra component)?
> > > >
> > > > Thanks and best regards,
> > > > René Ott
> > > >
> > > >
> > > >
> > >
> >
> >
> > --
> >
> > http://www.irian.at
> > Your JSF powerhouse -
> > JSF Trainings in English and German
> >
>
>


--

http://www.irian.at
Your JSF powerhouse -
JSF Trainings in English and German

Reply via email to