Hi Volker,

I'm sorry but I don't know where to call this. I post the full example:

My tag in the jsp:

<h:form>
                <h:dataTable
                var="person"
                binding="#{TableBean.personTable}"
                />
</h:form>

The TableBean:

public HtmlDataTable getPersonTable() {
                
                personTable = _getPersonTable(myPersonList);
                return personTable;
        }

private HtmlDataTable _getPersonTable(List<Person> people) {
                
                
                HtmlDataTable result = new HtmlDataTable();
                
                result.setValue(people);
                
                FacesContext context = FacesContext.getCurrentInstance();
                Application app = context.getApplication();
                        
                ValueBinding VBfirstName = 
app.createValueBinding("#{person.firstname}");
                ValueBinding VBsurName = 
app.createValueBinding("#{person.surname}");
                ValueBinding VBbirthDate = 
app.createValueBinding("#{person.birthdate}");
                ValueBinding VBtmpId = 
app.createValueBinding("#{person.tmpId}");
                ValueBinding VBchildren = 
app.createValueBinding("#{person.children}");
                
                
                ValueBinding VBpropTmpIdToDelete =
app.createValueBinding("#{TableBean.tmpIdToDelete}");
                                                                                
                                                
                        
                //MethodBinding MBdeleteListener =
app.createMethodBinding("#{TableBean.deleteListener}", new
Class[]{ActionEvent.class});
                //MethodBinding MBdeleteListener =
app.createMethodBinding("#{person.delete}", new
Class[]{ActionEvent.class});
                MethodBinding MBdeleteListener =
app.createMethodBinding("#{TableBean.delete}", new
Class[]{ActionEvent.class});
                MethodBinding MBaction = 
app.createMethodBinding("#{TableBean.action}", null);
                        
                        UIOutput headerFirstName = new UIOutput();
                        headerFirstName.setValue("Vorname");
                        
                        UIOutput headerSurName = new UIOutput();
                        headerSurName.setValue("Nachname");
                        
                        UIOutput headerBirthDate = new UIOutput();
                        headerSurName.setValue("Geburtsdatum");

                        UIOutput outputFirstname = new UIOutput();
                        outputFirstname.setValueBinding("value", VBfirstName);
                        
                        UIOutput outputSurname = new UIOutput();
                        outputSurname.setValueBinding("value", VBsurName);
                        
                        UIOutput outputBirthDate = new UIOutput();
                        outputBirthDate.setValueBinding("value", VBbirthDate);
                        
                        UIColumn columnFirstName = new UIColumn();
                        UIColumn columnSurName = new UIColumn();
                        UIColumn columnBirthDate = new UIColumn();
                        UIColumn columnDeleteButton = new UIColumn();
                        UIColumn columnChildren = new UIColumn();
                        
                        columnFirstName.setHeader(headerFirstName);
                        columnFirstName.getChildren().add(outputFirstname);
                        
                        columnSurName.setHeader(headerSurName);
                        columnSurName.getChildren().add(outputSurname);
                        
                        columnBirthDate.setHeader(headerBirthDate);
                        columnBirthDate.getChildren().add(outputBirthDate);
                        
                        
                        //HtmlCommandButton deleteButton = new 
HtmlCommandButton();
                        HtmlCommandButton deleteButton = (HtmlCommandButton)
app.createComponent(HtmlCommandButton.COMPONENT_TYPE);
                        
                        
                        deleteButton.setImage("images/img_delete.gif");
                        deleteButton.setActionListener(MBdeleteListener);
                        
                        UpdateActionListener ual = new UpdateActionListener();
                        ual.setPropertyBinding(VBpropTmpIdToDelete);
                        ual.setValueBinding(VBtmpId);
                        deleteButton.addActionListener(ual);
                        deleteButton.setAction(MBaction);
                        
                        columnDeleteButton.getChildren().add(deleteButton);
                        
                        

!!!!!!!!!!!!!!!!!!!!!!    HERE I NEED TO DO A RECURSIV CALL TO FILL
THE CHILDRENCOLUMN WITH A NEW DATATABLE
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                        //VariableResolver resolver = app.getVariableResolver();
                        //resolver.resolveVariable(arg0, arg1);
                        //ValueBindingImpl.ELVariableResolver res = new
ValueBindingImpl.ELVariableResolver(context);
                        
                        String value = (String)
app.getVariableResolver().resolveVariable(context, "person");
                        
                        //String value = (String)
app.createValueBinding("#{person}").getValue(context);
                        
!!!!!!!!!!!!!!!!!!!!!  HERE ALWAYS NULL IS RETURNED !!!!!!!!!!!!!!!!!!!!!!!!!1
logger.debug("Resolved: " + value);
                        
                        
                        
                        
                        
//columnChildren.getChildren().add(_getPersonTable(VBchildren));
                        
                        
                        result.getChildren().add(columnFirstName);
                        result.getChildren().add(columnSurName);
                        result.getChildren().add(columnBirthDate);
                        result.getChildren().add(columnDeleteButton);
                        result.getChildren().add(columnChildren);
                        
                
                
                return result;
        }


Do you have an idea?

Thank you,
Rudi

On 4/18/07, Volker Weber <[EMAIL PROTECTED]> wrote:
At which state in the lifecyle ?

the 'var' attribute of UIData is only available during processing the
UIDatas lifecycle methods.

e.g. only if uiData.isRowAvailable() returns true.

you can set the rowIndex to a specific value to force this e.g.:

uiData.setRowIndex(0);

to fetch the data for the first row.

don't forget to reset the rowindex (to -1)


Regards,
    Volker

2007/4/18, Rudi Steiner <[EMAIL PROTECTED]>:
> Hi Volker,
>
> I tried this but I just get null.
> Do you have further ideas?
>
> Thanks,
> Rudi
>
> On 4/18/07, Volker Weber <[EMAIL PROTECTED]> wrote:
> > Hi Rudi,
> >
> > you need the facesContext:
> > FacesContext facesContext = FacesContext.getCurrentInstance();
> >
> > try either
> >
> > app.getVariableResolver().resolveVariable(facesContext, "person");
> >
> > without the '#{' and '}'
> >
> > or
> >
> > app.createValueBinding("#{person}").getValue(facesContext);
> >
> >
> > Regards,
> >     Volker
> >
> > 2007/4/18, Rudi Steiner <[EMAIL PROTECTED]>:
> > > Hi Volker,
> > >
> > > thank you for the link. I had already tried it that way but it dosn't 
work.
> > >
> > > What I'm doing is the folloging:
> > >
> > > In the backingbean I generate a <h:dataTable/> on the fly
> > >
> > > private HtmlDataTable generateTable(List<Person> people){
> > >
> > > HtmlDataTable result = new HtmlDataTable();
> > >
> > > result.setValue(people);
> > >
> > > FacesContext context = FacesContext.getCurrentInstance();
> > > Application app = context.getApplication();
> > >
> > > ValueBinding VBfirstName = app.createValueBinding("#{person.firstname}");
> > > ValueBinding VBsurName = app.createValueBinding("#{person.surname}");
> > > ...
> > > UIOutput headerFirstName = new UIOutput();
> > > headerFirstName.setValue("Vorname");
> > > UIColumn columnFirstName = new UIColumn();
> > > columnFirstName.setHeader(headerFirstName);
> > >
> > > UIColumn columnChildren = new UIColumn();
> > >
> > > result.getChildren().add(columnFirstName);
> > >
> > >
> > > In the columnChildren I would like to include another HtmlDataTable by
> > > calling this method recursively , and as an parameter I would pass the
> > > childrenlist of the current person
> > > (gernerateTable(#{person}.getChildren)). To do this, I must have
> > > access to the object behind the EL-Expression #{person}
> > >
> > > Can you tell me, how I can resolve this EL-Expression.
> > > I tried it this way:
> > >
> > > VariableResolver resolver = app.getVariableResolver();
> > > resolver.resolveVariable(context, "#{person}");
> > >
> > > But it dosn't work. Do you know to which context I must resolve the
> > > EL-Expression?
> > >
> > > Best regards,
> > > Rudi
> > >
> > > On 4/17/07, Volker Weber <[EMAIL PROTECTED]> wrote:
> > > > Hi Rudi,
> > > >
> > > > see here:
> > > > http://wiki.apache.org/myfaces/AccessingOneManagedBeanFromAnother
> > > >
> > > >
> > > > Regards,
> > > >     Volker
> > > >
> > > > 2007/4/17, Rudi Steiner <[EMAIL PROTECTED]>:
> > > > > Hello,
> > > > >
> > > > > I'm creating a HtmlDataTable programmaticaly. So in my jsp I wrote 
just
> > > > >
> > > > > <h:form>
> > > > >                 <h:dataTable
> > > > >                 var="person"
> > > > >                 binding="#{TableBean.personTable}"
> > > > >                 />
> > > > >         </h:form>
> > > > >
> > > > > and created all the content of the dataTable in a method
> > > > > (createHtmlDataTableFromPersonList(List people)) in the
> > > > > backingbean(Columns, Buttons, ...). Everything works fine so far.
> > > > >
> > > > > My problem is, that I want to render a HtmlDataTable in the first
> > > > > table recursively and for this reason I have to resolve the variable
> > > > > person, to get the children of person an call
> > > > > createHtmlDataTableFromPersonList(List people) recursively.
> > > > >
> > > > > Could anyone tell me, how I can resolve the EL-Expression "#{person}",
> > > > > so that I have access to the real Object behind this expression.
> > > > >
> > > > > Thank you,
> > > > > Rudi
> > > > >
> > > >
> > >
> >
>

Reply via email to