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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>:
> >
> > 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
> >
>
>


--

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

Reply via email to