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