"#{name.value}" is not the correct syntax for the StaticText component.
The "name" keyword should not be a getter in your backing bean. It is a
variable given to the sourceVar property of the TableRowGroup component.
(It is used only in an EL expression as a pointer to the DataProvider.)
In order for your EL expression to work property, you must also include
a field key (e.g., "#{name.value.last}").
If you want examples of how to create a table dynamically, check out the
TLD docs below. Specifically, example #2 of tableRowGroup.
http://webdev2.sun.com/woodstock-tlddocs
The same "Dynamic Table" example can also be found in the Woodstock
example app.
http://webdev2.sun.com/example/faces/index.jsp
Dan
Brawn Do wrote:
> Hi,
>
> I've got a handle on dealing with POJO beans within my tables, but am
> unclear how to handle "simple" lists of primitive elements like
> strings. I must be missing the boat on this. With the code below I'm
> attempting to simply display the name "foo", but instead end up with a
> com.sun.webui.jsf.faces.DataProviderELResolver$ValueData toString()'d
> Can anyone lend a hand (code below)? Similar code works fine with
> POJO lists; e.g., where the name is a getter on a bean
> #{mybeanwithanamegetter.value.name
> <http://mybeanwithanamegetter.value.name>}
>
> Thanks!
>
> Table table = new Table();
> table.setId("tbl");
> TableRowGroup rowGroup = new TableRowGroup();
> rowGroup.setId("rowGroup");
> rowGroup.setSourceVar("name");
> List<String> names = new LinkedList<String>();
> names.add("foo");
> ListDataProvider provider = new ListDataProvider (names);
> rowGroup.setSourceData(provider);
> TableColumn column = new TableColumn();
> column.setId("col");
> column.setHeaderText("Value");
> StaticText nameText = new StaticText();
> nameText.setId("nameText");
> FacesContext context = FacesContext.getCurrentInstance();
> nameText.setValueExpression("value",
>
> context.getApplication().getExpressionFactory().createValueExpression(context.getELContext(),
> "#{name.value}",String.class)
>
> column.getChildren().add(nameText);
> rowGroup.getChildren().add(column);
> table.getChildren().add(rowGroup);