You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Rene Ott <re...@ososoft.de> on 2005/11/04 09:20:33 UTC

How to create component without binding?

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



Re: How to create component without binding?

Posted by Bruno Aranda <br...@gmail.com>.
You could add just the panelGroup (bound) and then add the components
as children of this panelGroup, so in the end you only have one
binding. Just use the method getChildren().add() of a component to add
children to that component,

Regards,

Bruno

2005/11/4, Rene Ott <re...@ososoft.de>:
> 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
>
>
>

Re: How to create component without binding?

Posted by Martin Marinschek <ma...@gmail.com>.
I don't know if this works, but f:subView doesn't render anything.

regards,

Martin

On 11/4/05, Rene Ott <re...@ososoft.de> wrote:
>
> That sounds good ;)
>
> How can I realize this?
>
> <f:view binding="my.backingbean">
>
> Like this?
>
> Does a component exist that acts just like a container for other components
> but itself doesn't get displayed? This way it would be possible to make a
> binding to this component without the need to display the component.
>
> René
>
> -----Ursprüngliche Nachricht-----
> Von: Martin Marinschek [mailto:martin.marinschek@gmail.com]
> Gesendet: Freitag, 4. November 2005 11:06
> An: MyFaces Discussion
> Betreff: Re: How to create component without binding?
>
> Then you'll need to do a binding for the ViewRoot ;)
>
> How would JSF know where to put your components, if you don't have
> them in the template?
>
> regards,
>
> Martin
>
> On 11/4/05, Rene Ott <re...@ososoft.de> wrote:
> > First thanks for the many answers in just one hour :-)
> >
> > Why do I need a binding to do this? If I need a binding to for example a
> > panelgroup this means that on the page the panelgroup gets rendered
> although
> > I don't need (or want) it.
> >
> > Lets assume I want to create dynamically several outputlinks. With a
> > panelgroup binding they are all inside a panelgroup. Why cannot I just
> hang
> > the outputlinks in UIviewroot and skip all the binding stuff?
> >
> > René Ott
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Martin Marinschek [mailto:martin.marinschek@gmail.com]
> > Gesendet: Freitag, 4. November 2005 09:49
> > An: MyFaces Discussion
> > Betreff: Re: How to create component without binding?
> >
> > 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 <ko...@gmail.com> wrote:
> > > Can you explain your task better, please.
> > >
> > > Nikita
> > >
> > > On 04/11/05, Rene Ott <re...@ososoft.de> 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
>
>
>
>


--

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

Re: AW: How to create component without binding?

Posted by Bruno Aranda <br...@gmail.com>.
Is your backing bean on request scope? Try to change it to session to
see if it works? Try also to put the code to create the component
dynamically in the constructor of the backing bean and not in the
setter...

Bruno

2005/11/4, Rene Ott <re...@ososoft.de>:
> I took a component binding to a panelGrid for testing and it worked quite
> well but the dynamically created components appear only once in the page. If
> I access the page a second time or reload the they disapper.
>
> The code I used is copied from here (the last entry):
>
> http://forums.java.sun.com/thread.jspa?threadID=555626&messageID=2816029
>
> What do I have to do that the components appear every time? I use facelets,
> does this have any impact?
>
> Many thanks in advance and best regards,
> René
>
> -----Ursprüngliche Nachricht-----
> Von: Volker Weber [mailto:users.myfaces@weber-oldenburg.de]
> Gesendet: Freitag, 4. November 2005 13:38
> An: MyFaces Discussion
> Betreff: Re: AW: How to create component without binding?
>
> Hi,
>
> the <h:panelGroup ...>  tag should render nothing but just the children
> if no "style" or "styleClass" attributes are present.
> So
>   <h:panelGroup binding="#{my.backingbean}">
> should do.
>
> see:
> http://java.sun.com/j2ee/javaserverfaces/1.1_01/docs/tlddocs/h/panelGroup.ht
> ml
>
> regards
>   Volker
>
> Rene Ott wrote:
> > That sounds good ;)
> >
> > How can I realize this?
> >
> > <f:view binding="my.backingbean">
> >
> > Like this?
> >
> > Does a component exist that acts just like a container for other
> components
> > but itself doesn't get displayed? This way it would be possible to make a
> > binding to this component without the need to display the component.
> >
> > René
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Martin Marinschek [mailto:martin.marinschek@gmail.com]
> > Gesendet: Freitag, 4. November 2005 11:06
> > An: MyFaces Discussion
> > Betreff: Re: How to create component without binding?
> >
> > Then you'll need to do a binding for the ViewRoot ;)
> >
> > How would JSF know where to put your components, if you don't have
> > them in the template?
> >
> > regards,
> >
> > Martin
> >
> > On 11/4/05, Rene Ott <re...@ososoft.de> wrote:
> >
> >>First thanks for the many answers in just one hour :-)
> >>
> >>Why do I need a binding to do this? If I need a binding to for example a
> >>panelgroup this means that on the page the panelgroup gets rendered
> >
> > although
> >
> >>I don't need (or want) it.
> >>
> >>Lets assume I want to create dynamically several outputlinks. With a
> >>panelgroup binding they are all inside a panelgroup. Why cannot I just
> >
> > hang
> >
> >>the outputlinks in UIviewroot and skip all the binding stuff?
> >>
> >>René Ott
> >>
> >>-----Ursprüngliche Nachricht-----
> >>Von: Martin Marinschek [mailto:martin.marinschek@gmail.com]
> >>Gesendet: Freitag, 4. November 2005 09:49
> >>An: MyFaces Discussion
> >>Betreff: Re: How to create component without binding?
> >>
> >>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 <ko...@gmail.com> wrote:
> >>
> >>>Can you explain your task better, please.
> >>>
> >>>Nikita
> >>>
> >>>On 04/11/05, Rene Ott <re...@ososoft.de> 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
> >
> >
> >
>
> --
> Don't answer to From: address!
> Mail to this account are droped if not recieved via mailinglist.
> To contact me direct create the mail address by
> concatenating my forename to my senders domain.
>
>
>
>

AW: AW: How to create component without binding?

Posted by Rene Ott <re...@ososoft.de>.
I took a component binding to a panelGrid for testing and it worked quite
well but the dynamically created components appear only once in the page. If
I access the page a second time or reload the they disapper.

The code I used is copied from here (the last entry):

http://forums.java.sun.com/thread.jspa?threadID=555626&messageID=2816029

What do I have to do that the components appear every time? I use facelets,
does this have any impact?

Many thanks in advance and best regards,
René 
 
-----Ursprüngliche Nachricht-----
Von: Volker Weber [mailto:users.myfaces@weber-oldenburg.de] 
Gesendet: Freitag, 4. November 2005 13:38
An: MyFaces Discussion
Betreff: Re: AW: How to create component without binding?

Hi,

the <h:panelGroup ...>  tag should render nothing but just the children
if no "style" or "styleClass" attributes are present.
So
  <h:panelGroup binding="#{my.backingbean}">
should do.

see:
http://java.sun.com/j2ee/javaserverfaces/1.1_01/docs/tlddocs/h/panelGroup.ht
ml

regards
  Volker

Rene Ott wrote:
> That sounds good ;)
> 
> How can I realize this?
> 
> <f:view binding="my.backingbean">
> 
> Like this?
> 
> Does a component exist that acts just like a container for other
components
> but itself doesn't get displayed? This way it would be possible to make a
> binding to this component without the need to display the component.
> 
> René 
> 
> -----Ursprüngliche Nachricht-----
> Von: Martin Marinschek [mailto:martin.marinschek@gmail.com] 
> Gesendet: Freitag, 4. November 2005 11:06
> An: MyFaces Discussion
> Betreff: Re: How to create component without binding?
> 
> Then you'll need to do a binding for the ViewRoot ;)
> 
> How would JSF know where to put your components, if you don't have
> them in the template?
> 
> regards,
> 
> Martin
> 
> On 11/4/05, Rene Ott <re...@ososoft.de> wrote:
> 
>>First thanks for the many answers in just one hour :-)
>>
>>Why do I need a binding to do this? If I need a binding to for example a
>>panelgroup this means that on the page the panelgroup gets rendered
> 
> although
> 
>>I don't need (or want) it.
>>
>>Lets assume I want to create dynamically several outputlinks. With a
>>panelgroup binding they are all inside a panelgroup. Why cannot I just
> 
> hang
> 
>>the outputlinks in UIviewroot and skip all the binding stuff?
>>
>>René Ott
>>
>>-----Ursprüngliche Nachricht-----
>>Von: Martin Marinschek [mailto:martin.marinschek@gmail.com]
>>Gesendet: Freitag, 4. November 2005 09:49
>>An: MyFaces Discussion
>>Betreff: Re: How to create component without binding?
>>
>>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 <ko...@gmail.com> wrote:
>>
>>>Can you explain your task better, please.
>>>
>>>Nikita
>>>
>>>On 04/11/05, Rene Ott <re...@ososoft.de> 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
> 
> 
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.




Re: AW: How to create component without binding?

Posted by Volker Weber <us...@weber-oldenburg.de>.
Hi,

the <h:panelGroup ...>  tag should render nothing but just the children
if no "style" or "styleClass" attributes are present.
So
  <h:panelGroup binding="#{my.backingbean}">
should do.

see:
http://java.sun.com/j2ee/javaserverfaces/1.1_01/docs/tlddocs/h/panelGroup.html

regards
  Volker

Rene Ott wrote:
> That sounds good ;)
> 
> How can I realize this?
> 
> <f:view binding="my.backingbean">
> 
> Like this?
> 
> Does a component exist that acts just like a container for other components
> but itself doesn't get displayed? This way it would be possible to make a
> binding to this component without the need to display the component.
> 
> René 
> 
> -----Ursprüngliche Nachricht-----
> Von: Martin Marinschek [mailto:martin.marinschek@gmail.com] 
> Gesendet: Freitag, 4. November 2005 11:06
> An: MyFaces Discussion
> Betreff: Re: How to create component without binding?
> 
> Then you'll need to do a binding for the ViewRoot ;)
> 
> How would JSF know where to put your components, if you don't have
> them in the template?
> 
> regards,
> 
> Martin
> 
> On 11/4/05, Rene Ott <re...@ososoft.de> wrote:
> 
>>First thanks for the many answers in just one hour :-)
>>
>>Why do I need a binding to do this? If I need a binding to for example a
>>panelgroup this means that on the page the panelgroup gets rendered
> 
> although
> 
>>I don't need (or want) it.
>>
>>Lets assume I want to create dynamically several outputlinks. With a
>>panelgroup binding they are all inside a panelgroup. Why cannot I just
> 
> hang
> 
>>the outputlinks in UIviewroot and skip all the binding stuff?
>>
>>René Ott
>>
>>-----Ursprüngliche Nachricht-----
>>Von: Martin Marinschek [mailto:martin.marinschek@gmail.com]
>>Gesendet: Freitag, 4. November 2005 09:49
>>An: MyFaces Discussion
>>Betreff: Re: How to create component without binding?
>>
>>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 <ko...@gmail.com> wrote:
>>
>>>Can you explain your task better, please.
>>>
>>>Nikita
>>>
>>>On 04/11/05, Rene Ott <re...@ososoft.de> 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
> 
> 
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.

AW: How to create component without binding?

Posted by Rene Ott <re...@ososoft.de>.
That sounds good ;)

How can I realize this?

<f:view binding="my.backingbean">

Like this?

Does a component exist that acts just like a container for other components
but itself doesn't get displayed? This way it would be possible to make a
binding to this component without the need to display the component.

René 

-----Ursprüngliche Nachricht-----
Von: Martin Marinschek [mailto:martin.marinschek@gmail.com] 
Gesendet: Freitag, 4. November 2005 11:06
An: MyFaces Discussion
Betreff: Re: How to create component without binding?

Then you'll need to do a binding for the ViewRoot ;)

How would JSF know where to put your components, if you don't have
them in the template?

regards,

Martin

On 11/4/05, Rene Ott <re...@ososoft.de> wrote:
> First thanks for the many answers in just one hour :-)
>
> Why do I need a binding to do this? If I need a binding to for example a
> panelgroup this means that on the page the panelgroup gets rendered
although
> I don't need (or want) it.
>
> Lets assume I want to create dynamically several outputlinks. With a
> panelgroup binding they are all inside a panelgroup. Why cannot I just
hang
> the outputlinks in UIviewroot and skip all the binding stuff?
>
> René Ott
>
> -----Ursprüngliche Nachricht-----
> Von: Martin Marinschek [mailto:martin.marinschek@gmail.com]
> Gesendet: Freitag, 4. November 2005 09:49
> An: MyFaces Discussion
> Betreff: Re: How to create component without binding?
>
> 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 <ko...@gmail.com> wrote:
> > Can you explain your task better, please.
> >
> > Nikita
> >
> > On 04/11/05, Rene Ott <re...@ososoft.de> 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




Re: How to create component without binding?

Posted by Martin Marinschek <ma...@gmail.com>.
Then you'll need to do a binding for the ViewRoot ;)

How would JSF know where to put your components, if you don't have
them in the template?

regards,

Martin

On 11/4/05, Rene Ott <re...@ososoft.de> wrote:
> First thanks for the many answers in just one hour :-)
>
> Why do I need a binding to do this? If I need a binding to for example a
> panelgroup this means that on the page the panelgroup gets rendered although
> I don't need (or want) it.
>
> Lets assume I want to create dynamically several outputlinks. With a
> panelgroup binding they are all inside a panelgroup. Why cannot I just hang
> the outputlinks in UIviewroot and skip all the binding stuff?
>
> René Ott
>
> -----Ursprüngliche Nachricht-----
> Von: Martin Marinschek [mailto:martin.marinschek@gmail.com]
> Gesendet: Freitag, 4. November 2005 09:49
> An: MyFaces Discussion
> Betreff: Re: How to create component without binding?
>
> 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 <ko...@gmail.com> wrote:
> > Can you explain your task better, please.
> >
> > Nikita
> >
> > On 04/11/05, Rene Ott <re...@ososoft.de> 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

Re: How to create component without binding?

Posted by Enrique Medina <e....@gmail.com>.
Yes, I've tried so. A simple text works. Then the tab also works, as the
result I'm getting now is the tab, but totally empty.

I have checked once and again my code, but don't see anything wrong with it.

Maybe other eyes can see what I don't see...

2005/11/4, Bruno Aranda <br...@gmail.com>:
>
> Have you try to simplify your code to see if the binding works ok?
> Just put an HtmlOutputText in the panel, for instance... and if that
> works, add more logic...
>
> Regards,
>
> Bruno
>
> 2005/11/4, Enrique Medina <e....@gmail.com>:
> > Yes, that's what I am doing. But the thing is I cannot make it work.
> >
> > See my code (but nothing appears in my JSP page):
> >
> > public void setPanelTabuladores(UIPanel panelTabuladores)
> > {
> > if (this.panelTabuladores == null)
> > {
> > this.panelTabuladores = panelTabuladores;
> >
> > UIPanel tab0 = (HtmlPanelTab) FacesUtils.getApplication()
> > .createComponent(HtmlPanelTab.COMPONENT_TYPE);
> >
> > tab0.setId("panelTab0");
> > tab0.getAttributes().put("label", "Variable0");
> >
> > UIData tabla0 = (HtmlDataTable) FacesUtils.getApplication()
> > .createComponent(HtmlDataTable.COMPONENT_TYPE);
> > tabla0.setId("tablaEdicionPuntuaciones0");
> > tabla0.setVar("puntuacion0");
> > tabla0.getAttributes().put("width", "100%");
> > tabla0.getAttributes().put("cellspacing", "1");
> > tabla0.getAttributes().put("cellpadding", "2");
> > tabla0.getAttributes().put("renderedIfEmpty", Boolean.FALSE);
> > tabla0.getAttributes().put("preserveDataModel", Boolean.FALSE);
> > tabla0.setValueBinding("value", FacesUtils
> >
> > .getValueBinding("#{puntuaciones.listasPuntuaciones[0]}"));
> > tabla0.setRows(10);
> > tabla0.getAttributes().put("rowClasses", "impar,par");
> > tabla0.getAttributes().put("headerClass", "apptblhdr");
> > tabla0.getAttributes().put("rowIndexVar", "numFila0");
> > tabla0.getAttributes().put("rowOnMouseOver", "tblOver(this)");
> > tabla0.getAttributes().put("rowOnMouseOut",
> > "tblOut(this, #{numFila0%2})");
> >
> > UIColumn col1 = (HtmlSimpleColumn) FacesUtils.getApplication()
> > .createComponent(HtmlSimpleColumn.COMPONENT_TYPE);
> > col1.getAttributes().put("style", "text-align: center;");
> > UIOutput texto1 = (HtmlOutputText) FacesUtils.getApplication()
> > .createComponent(HtmlOutputText.COMPONENT_TYPE);
> > texto1.setValueBinding("value", FacesUtils
> > .getValueBinding("#{mensajes.puntuaciones_Tramos}"));
> > col1.setHeader(texto1);
> > UIOutput texto2 = (HtmlOutputText) FacesUtils.getApplication()
> > .createComponent(HtmlOutputText.COMPONENT_TYPE);
> > texto2
> > .setValueBinding(
> > "value",
> > FacesUtils
> >
> > .getValueBinding("#{puntuacion0.valor.minimo} -
> > #{puntuacion0.valor.maximo}"));
> > col1.getChildren().add(texto2);
> >
> > UIColumn col2 = (HtmlSimpleColumn) FacesUtils.getApplication()
> > .createComponent(HtmlSimpleColumn.COMPONENT_TYPE);
> > col2.getAttributes().put("style", "text-align: center;");
> > UIInput texto3 = (HtmlInputText) FacesUtils.getApplication()
> > .createComponent(HtmlInputText.COMPONENT_TYPE);
> > texto3.setValueBinding("value", FacesUtils
> > .getValueBinding("#{puntuacion0.puntuacion}"));
> > col2.getChildren().add(texto3);
> >
> > tabla0.getChildren().add(col1);
> > tabla0.getChildren().add(col2);
> >
> > tab0.getChildren().add(tabla0);
> >
> > this.panelTabuladores.getChildren().add(tab0);
> > }
> > }
> >
> >
> > 2005/11/4, Martin Marinschek <ma...@gmail.com>:
> > >
> > > 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 < e.medina.m@gmail.com> 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 < martin.marinschek@gmail.com>:
> > > > > 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 <ko...@gmail.com> wrote:
> > > > > > Can you explain your task better, please.
> > > > > >
> > > > > > Nikita
> > > > > >
> > > > > > On 04/11/05, Rene Ott < rene.ott@ososoft.de> 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
> > >
> >
> >
>

Re: How to create component without binding?

Posted by Bruno Aranda <br...@gmail.com>.
Have you try to simplify your code to see if the binding works ok?
Just put an HtmlOutputText in the panel, for instance... and if that
works, add more logic...

Regards,

Bruno

2005/11/4, Enrique Medina <e....@gmail.com>:
> Yes, that's what I am doing. But the thing is I cannot make it work.
>
>  See my code (but nothing appears in my JSP page):
>
>      public void setPanelTabuladores(UIPanel panelTabuladores)
>      {
>          if (this.panelTabuladores == null)
>          {
>              this.panelTabuladores = panelTabuladores;
>
>              UIPanel tab0 = (HtmlPanelTab) FacesUtils.getApplication()
>                      .createComponent(HtmlPanelTab.COMPONENT_TYPE);
>
>              tab0.setId("panelTab0");
>              tab0.getAttributes().put("label", "Variable0");
>
>              UIData tabla0 = (HtmlDataTable) FacesUtils.getApplication()
>                      .createComponent(HtmlDataTable.COMPONENT_TYPE);
>              tabla0.setId("tablaEdicionPuntuaciones0");
>              tabla0.setVar("puntuacion0");
>              tabla0.getAttributes().put("width", "100%");
>              tabla0.getAttributes().put("cellspacing", "1");
>              tabla0.getAttributes().put("cellpadding", "2");
>              tabla0.getAttributes().put("renderedIfEmpty", Boolean.FALSE);
>              tabla0.getAttributes().put("preserveDataModel", Boolean.FALSE);
>              tabla0.setValueBinding("value", FacesUtils
>
> .getValueBinding("#{puntuaciones.listasPuntuaciones[0]}"));
>              tabla0.setRows(10);
>              tabla0.getAttributes().put("rowClasses", "impar,par");
>              tabla0.getAttributes().put("headerClass", "apptblhdr");
>              tabla0.getAttributes().put("rowIndexVar", "numFila0");
>              tabla0.getAttributes().put("rowOnMouseOver", "tblOver(this)");
>              tabla0.getAttributes().put("rowOnMouseOut",
>                      "tblOut(this, #{numFila0%2})");
>
>              UIColumn col1 = (HtmlSimpleColumn) FacesUtils.getApplication()
>                      .createComponent(HtmlSimpleColumn.COMPONENT_TYPE);
>              col1.getAttributes().put("style", "text-align: center;");
>              UIOutput texto1 = (HtmlOutputText) FacesUtils.getApplication()
>                      .createComponent(HtmlOutputText.COMPONENT_TYPE);
>              texto1.setValueBinding("value", FacesUtils
>                      .getValueBinding("#{mensajes.puntuaciones_Tramos}"));
>              col1.setHeader(texto1);
>              UIOutput texto2 = (HtmlOutputText) FacesUtils.getApplication()
>                      .createComponent(HtmlOutputText.COMPONENT_TYPE);
>              texto2
>                      .setValueBinding(
>                              "value",
>                              FacesUtils
>
> .getValueBinding("#{puntuacion0.valor.minimo} -
> #{puntuacion0.valor.maximo}"));
>              col1.getChildren().add(texto2);
>
>              UIColumn col2 = (HtmlSimpleColumn) FacesUtils.getApplication()
>                      .createComponent(HtmlSimpleColumn.COMPONENT_TYPE);
>              col2.getAttributes().put("style", "text-align: center;");
>              UIInput texto3 = (HtmlInputText) FacesUtils.getApplication()
>                      .createComponent(HtmlInputText.COMPONENT_TYPE);
>              texto3.setValueBinding("value", FacesUtils
>                      .getValueBinding("#{puntuacion0.puntuacion}"));
>              col2.getChildren().add(texto3);
>
>              tabla0.getChildren().add(col1);
>              tabla0.getChildren().add(col2);
>
>              tab0.getChildren().add(tabla0);
>
>              this.panelTabuladores.getChildren().add(tab0);
>          }
>      }
>
>
> 2005/11/4, Martin Marinschek <ma...@gmail.com>:
> >
> > 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 < e.medina.m@gmail.com> 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 < martin.marinschek@gmail.com>:
> > > > 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 <ko...@gmail.com> wrote:
> > > > > Can you explain your task better, please.
> > > > >
> > > > > Nikita
> > > > >
> > > > > On 04/11/05, Rene Ott < rene.ott@ososoft.de> 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
> >
>
>

Re: How to create component without binding?

Posted by Enrique Medina <e....@gmail.com>.
The debug shows that:

1) The getter is only called every time the page is rendered coming from
another different page. If it is re-rendered (for example, because you click
on the tab), the getter is not called
2) The setter is called:
2.1) Just after the only time the getter is invoked (I think this is the
perfect point to create all the components)
2.2) Every time I click on the tab (simply return the parameter passed by
JSF)
2.3) Sometimes when I navigate to another page (simply return the parameter
passed by JSF - ignore it)

I also noticed then that I should always return null from the getter, so
every time this page is called, the components must be recreated, as it is
probably that the data has changed....

2005/11/4, Martin Marinschek <ma...@gmail.com>:
>
> This won't work - on every request, your setter will be called by the
> JSF implementation. And on every request, you will get passed a new
> component reference (except you do server side state saving, then this
> might actually be the same) as it is serialized/deserialized from the
> saved state.
>
> Can you debug in what happens with your get/set pair? You should
> easily find out what is going out then...
>
> regards,
>
> Martin
>
> On 11/4/05, Enrique Medina <e....@gmail.com> wrote:
> > Yes, that's what I am doing. But the thing is I cannot make it work.
> >
> > See my code (but nothing appears in my JSP page):
> >
> > public void setPanelTabuladores(UIPanel panelTabuladores)
> > {
> > if (this.panelTabuladores == null)
> > {
> > this.panelTabuladores = panelTabuladores;
> >
> > UIPanel tab0 = (HtmlPanelTab) FacesUtils.getApplication()
> > .createComponent(HtmlPanelTab.COMPONENT_TYPE);
> >
> > tab0.setId("panelTab0");
> > tab0.getAttributes().put("label", "Variable0");
> >
> > UIData tabla0 = (HtmlDataTable) FacesUtils.getApplication()
> > .createComponent(HtmlDataTable.COMPONENT_TYPE);
> > tabla0.setId("tablaEdicionPuntuaciones0");
> > tabla0.setVar("puntuacion0");
> > tabla0.getAttributes().put("width", "100%");
> > tabla0.getAttributes().put("cellspacing", "1");
> > tabla0.getAttributes().put("cellpadding", "2");
> > tabla0.getAttributes().put("renderedIfEmpty", Boolean.FALSE);
> > tabla0.getAttributes().put("preserveDataModel", Boolean.FALSE);
> > tabla0.setValueBinding("value", FacesUtils
> >
> > .getValueBinding("#{puntuaciones.listasPuntuaciones[0]}"));
> > tabla0.setRows(10);
> > tabla0.getAttributes().put("rowClasses", "impar,par");
> > tabla0.getAttributes().put("headerClass", "apptblhdr");
> > tabla0.getAttributes().put("rowIndexVar", "numFila0");
> > tabla0.getAttributes().put("rowOnMouseOver", "tblOver(this)");
> > tabla0.getAttributes().put("rowOnMouseOut",
> > "tblOut(this, #{numFila0%2})");
> >
> > UIColumn col1 = (HtmlSimpleColumn) FacesUtils.getApplication()
> > .createComponent(HtmlSimpleColumn.COMPONENT_TYPE);
> > col1.getAttributes().put("style", "text-align: center;");
> > UIOutput texto1 = (HtmlOutputText) FacesUtils.getApplication()
> > .createComponent(HtmlOutputText.COMPONENT_TYPE);
> > texto1.setValueBinding("value", FacesUtils
> > .getValueBinding("#{mensajes.puntuaciones_Tramos}"));
> > col1.setHeader(texto1);
> > UIOutput texto2 = (HtmlOutputText) FacesUtils.getApplication()
> > .createComponent(HtmlOutputText.COMPONENT_TYPE);
> > texto2
> > .setValueBinding(
> > "value",
> > FacesUtils
> >
> > .getValueBinding("#{puntuacion0.valor.minimo} -
> > #{puntuacion0.valor.maximo}"));
> > col1.getChildren().add(texto2);
> >
> > UIColumn col2 = (HtmlSimpleColumn) FacesUtils.getApplication()
> > .createComponent(HtmlSimpleColumn.COMPONENT_TYPE);
> > col2.getAttributes().put("style", "text-align: center;");
> > UIInput texto3 = (HtmlInputText) FacesUtils.getApplication()
> > .createComponent(HtmlInputText.COMPONENT_TYPE);
> > texto3.setValueBinding("value", FacesUtils
> > .getValueBinding("#{puntuacion0.puntuacion}"));
> > col2.getChildren().add(texto3);
> >
> > tabla0.getChildren().add(col1);
> > tabla0.getChildren().add(col2);
> >
> > tab0.getChildren().add(tabla0);
> >
> > this.panelTabuladores.getChildren().add(tab0);
> > }
> > }
> >
> >
> > 2005/11/4, Martin Marinschek <ma...@gmail.com>:
> > >
> > > 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 < e.medina.m@gmail.com> 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 < martin.marinschek@gmail.com>:
> > > > > 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 <ko...@gmail.com> wrote:
> > > > > > Can you explain your task better, please.
> > > > > >
> > > > > > Nikita
> > > > > >
> > > > > > On 04/11/05, Rene Ott < rene.ott@ososoft.de> 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
> > >
> >
> >
>
>
> --
>
> http://www.irian.at
> Your JSF powerhouse -
> JSF Trainings in English and German
>

Re: How to create component without binding?

Posted by Martin Marinschek <ma...@gmail.com>.
This won't work - on every request, your setter will be called by the
JSF implementation. And on every request, you will get passed a new
component reference (except you do server side state saving, then this
might actually be the same) as it is serialized/deserialized from the
saved state.

Can you debug in what happens with your get/set pair? You should
easily find out what is going out then...

regards,

Martin

On 11/4/05, Enrique Medina <e....@gmail.com> wrote:
> Yes, that's what I am doing. But the thing is I cannot make it work.
>
>  See my code (but nothing appears in my JSP page):
>
>      public void setPanelTabuladores(UIPanel panelTabuladores)
>      {
>          if (this.panelTabuladores == null)
>          {
>              this.panelTabuladores = panelTabuladores;
>
>              UIPanel tab0 = (HtmlPanelTab) FacesUtils.getApplication()
>                      .createComponent(HtmlPanelTab.COMPONENT_TYPE);
>
>              tab0.setId("panelTab0");
>              tab0.getAttributes().put("label", "Variable0");
>
>              UIData tabla0 = (HtmlDataTable) FacesUtils.getApplication()
>                      .createComponent(HtmlDataTable.COMPONENT_TYPE);
>              tabla0.setId("tablaEdicionPuntuaciones0");
>              tabla0.setVar("puntuacion0");
>              tabla0.getAttributes().put("width", "100%");
>              tabla0.getAttributes().put("cellspacing", "1");
>              tabla0.getAttributes().put("cellpadding", "2");
>              tabla0.getAttributes().put("renderedIfEmpty", Boolean.FALSE);
>              tabla0.getAttributes().put("preserveDataModel", Boolean.FALSE);
>              tabla0.setValueBinding("value", FacesUtils
>
> .getValueBinding("#{puntuaciones.listasPuntuaciones[0]}"));
>              tabla0.setRows(10);
>              tabla0.getAttributes().put("rowClasses", "impar,par");
>              tabla0.getAttributes().put("headerClass", "apptblhdr");
>              tabla0.getAttributes().put("rowIndexVar", "numFila0");
>              tabla0.getAttributes().put("rowOnMouseOver", "tblOver(this)");
>              tabla0.getAttributes().put("rowOnMouseOut",
>                      "tblOut(this, #{numFila0%2})");
>
>              UIColumn col1 = (HtmlSimpleColumn) FacesUtils.getApplication()
>                      .createComponent(HtmlSimpleColumn.COMPONENT_TYPE);
>              col1.getAttributes().put("style", "text-align: center;");
>              UIOutput texto1 = (HtmlOutputText) FacesUtils.getApplication()
>                      .createComponent(HtmlOutputText.COMPONENT_TYPE);
>              texto1.setValueBinding("value", FacesUtils
>                      .getValueBinding("#{mensajes.puntuaciones_Tramos}"));
>              col1.setHeader(texto1);
>              UIOutput texto2 = (HtmlOutputText) FacesUtils.getApplication()
>                      .createComponent(HtmlOutputText.COMPONENT_TYPE);
>              texto2
>                      .setValueBinding(
>                              "value",
>                              FacesUtils
>
> .getValueBinding("#{puntuacion0.valor.minimo} -
> #{puntuacion0.valor.maximo}"));
>              col1.getChildren().add(texto2);
>
>              UIColumn col2 = (HtmlSimpleColumn) FacesUtils.getApplication()
>                      .createComponent(HtmlSimpleColumn.COMPONENT_TYPE);
>              col2.getAttributes().put("style", "text-align: center;");
>              UIInput texto3 = (HtmlInputText) FacesUtils.getApplication()
>                      .createComponent(HtmlInputText.COMPONENT_TYPE);
>              texto3.setValueBinding("value", FacesUtils
>                      .getValueBinding("#{puntuacion0.puntuacion}"));
>              col2.getChildren().add(texto3);
>
>              tabla0.getChildren().add(col1);
>              tabla0.getChildren().add(col2);
>
>              tab0.getChildren().add(tabla0);
>
>              this.panelTabuladores.getChildren().add(tab0);
>          }
>      }
>
>
> 2005/11/4, Martin Marinschek <ma...@gmail.com>:
> >
> > 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 < e.medina.m@gmail.com> 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 < martin.marinschek@gmail.com>:
> > > > 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 <ko...@gmail.com> wrote:
> > > > > Can you explain your task better, please.
> > > > >
> > > > > Nikita
> > > > >
> > > > > On 04/11/05, Rene Ott < rene.ott@ososoft.de> 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
> >
>
>


--

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

Re: How to create component without binding?

Posted by Enrique Medina <e....@gmail.com>.
Yes, that's what I am doing. But the thing is I cannot make it work.

See my code (but nothing appears in my JSP page):

public void setPanelTabuladores(UIPanel panelTabuladores)
{
if (this.panelTabuladores == null)
{
this.panelTabuladores = panelTabuladores;

UIPanel tab0 = (HtmlPanelTab) FacesUtils.getApplication()
.createComponent(HtmlPanelTab.COMPONENT_TYPE);

tab0.setId("panelTab0");
tab0.getAttributes().put("label", "Variable0");

UIData tabla0 = (HtmlDataTable) FacesUtils.getApplication()
.createComponent(HtmlDataTable.COMPONENT_TYPE);
tabla0.setId("tablaEdicionPuntuaciones0");
tabla0.setVar("puntuacion0");
tabla0.getAttributes().put("width", "100%");
tabla0.getAttributes().put("cellspacing", "1");
tabla0.getAttributes().put("cellpadding", "2");
tabla0.getAttributes().put("renderedIfEmpty", Boolean.FALSE);
tabla0.getAttributes().put("preserveDataModel", Boolean.FALSE);
tabla0.setValueBinding("value", FacesUtils
.getValueBinding("#{puntuaciones.listasPuntuaciones[0]}"));
tabla0.setRows(10);
tabla0.getAttributes().put("rowClasses", "impar,par");
tabla0.getAttributes().put("headerClass", "apptblhdr");
tabla0.getAttributes().put("rowIndexVar", "numFila0");
tabla0.getAttributes().put("rowOnMouseOver", "tblOver(this)");
tabla0.getAttributes().put("rowOnMouseOut",
"tblOut(this, #{numFila0%2})");

UIColumn col1 = (HtmlSimpleColumn) FacesUtils.getApplication()
.createComponent(HtmlSimpleColumn.COMPONENT_TYPE);
col1.getAttributes().put("style", "text-align: center;");
UIOutput texto1 = (HtmlOutputText) FacesUtils.getApplication()
.createComponent(HtmlOutputText.COMPONENT_TYPE);
texto1.setValueBinding("value", FacesUtils
.getValueBinding("#{mensajes.puntuaciones_Tramos}"));
col1.setHeader(texto1);
UIOutput texto2 = (HtmlOutputText) FacesUtils.getApplication()
.createComponent(HtmlOutputText.COMPONENT_TYPE);
texto2
.setValueBinding(
"value",
FacesUtils
.getValueBinding("#{puntuacion0.valor.minimo} - #{puntuacion0.valor.maximo
}"));
col1.getChildren().add(texto2);

UIColumn col2 = (HtmlSimpleColumn) FacesUtils.getApplication()
.createComponent(HtmlSimpleColumn.COMPONENT_TYPE);
col2.getAttributes().put("style", "text-align: center;");
UIInput texto3 = (HtmlInputText) FacesUtils.getApplication()
.createComponent(HtmlInputText.COMPONENT_TYPE);
texto3.setValueBinding("value", FacesUtils
.getValueBinding("#{puntuacion0.puntuacion}"));
col2.getChildren().add(texto3);

tabla0.getChildren().add(col1);
tabla0.getChildren().add(col2);

tab0.getChildren().add(tabla0);

this.panelTabuladores.getChildren().add(tab0);
}
}

2005/11/4, Martin Marinschek <ma...@gmail.com>:
>
> 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 <e....@gmail.com> 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 <ma...@gmail.com>:
> > > 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 <ko...@gmail.com> wrote:
> > > > Can you explain your task better, please.
> > > >
> > > > Nikita
> > > >
> > > > On 04/11/05, Rene Ott < rene.ott@ososoft.de> 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
>

Re: How to create component without binding?

Posted by Martin Marinschek <ma...@gmail.com>.
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 <e....@gmail.com> 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 <ma...@gmail.com>:
> > 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 <ko...@gmail.com> wrote:
> > > Can you explain your task better, please.
> > >
> > > Nikita
> > >
> > > On 04/11/05, Rene Ott < rene.ott@ososoft.de> 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

Re: How to create component without binding?

Posted by Enrique Medina <e....@gmail.com>.
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 <ma...@gmail.com>:
>
> 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 <ko...@gmail.com> wrote:
> > Can you explain your task better, please.
> >
> > Nikita
> >
> > On 04/11/05, Rene Ott <re...@ososoft.de> 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
>

AW: How to create component without binding?

Posted by Rene Ott <re...@ososoft.de>.
First thanks for the many answers in just one hour :-)

Why do I need a binding to do this? If I need a binding to for example a
panelgroup this means that on the page the panelgroup gets rendered although
I don't need (or want) it.

Lets assume I want to create dynamically several outputlinks. With a
panelgroup binding they are all inside a panelgroup. Why cannot I just hang
the outputlinks in UIviewroot and skip all the binding stuff?

René Ott

-----Ursprüngliche Nachricht-----
Von: Martin Marinschek [mailto:martin.marinschek@gmail.com] 
Gesendet: Freitag, 4. November 2005 09:49
An: MyFaces Discussion
Betreff: Re: How to create component without binding?

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 <ko...@gmail.com> wrote:
> Can you explain your task better, please.
>
> Nikita
>
> On 04/11/05, Rene Ott <re...@ososoft.de> 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




Re: How to create component without binding?

Posted by Martin Marinschek <ma...@gmail.com>.
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 <ko...@gmail.com> wrote:
> Can you explain your task better, please.
>
> Nikita
>
> On 04/11/05, Rene Ott <re...@ososoft.de> 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

Re: How to create component without binding?

Posted by Nikita Koselev <ko...@gmail.com>.
Can you explain your task better, please.

Nikita

On 04/11/05, Rene Ott <re...@ososoft.de> 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
>
>
>

Re: How to create component without binding?

Posted by Volker Weber <us...@weber-oldenburg.de>.
Hello,

you can create a component subtree in your application, but at least you
 need one tag with a binding to your subtrees root component to include
these into your view.

regards

 Volker

Rene Ott 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
> 
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.