actionDataTable.setValueExpression("value",
createValueExpression("#{myBean.dataList}", List.class));
actionDataTable.setVar("dataItem");
// Create <h:column> for 'ID' column.
HtmlColumn idColumn = new HtmlColumn();
actionDataTable.getChildren().add(idColumn);
// Create <h:outputText value="ID"> for <f:facet name="header"> of 'ID' column.
HtmlOutputText idHeader = new HtmlOutputText();
idHeader.setValue("ID");
idColumn.setHeader(idHeader);
// Create <h:commandLink value="#{dataItem.id}" action="#{myBean.editPopulatedDataItem}" />
// for the body of 'ID' column.
HtmlCommandLink idLink = new HtmlCommandLink();
idLink.setId("edit"); // Custom ID is required in dynamic UIInput and UICommand.
idLink.setValueExpression("value",
createValueExpression("#{dataItem.id}", Long.class));
idLink.setActionExpression(
createActionExpression("#{myBean.editPopulatedDataItem}", String.class));
idColumn.getChildren().add(idLink);
// Create <h:column> for 'Name' column.
HtmlColumn nameColumn = new HtmlColumn();
actionDataTable.getChildren().add(nameColumn);
// Create <h:outputText value="Name"> for <f:facet name="header"> of 'Name' column.
HtmlOutputText nameHeader = new HtmlOutputText();
nameHeader.setValue("Name");
nameColumn.setHeader(nameHeader);
// Create <h:outputText value="#{dataItem.name}"> for the body of 'Name' column.
HtmlOutputText nameOutput = new HtmlOutputText();
nameOutput.setValueExpression("value",
createValueExpression("#{dataItem.name}", String.class));
nameColumn.getChildren().add(nameOutput);
// Create <h:column> for 'Value' column.
HtmlColumn valueColumn = new HtmlColumn();
actionDataTable.getChildren().add(valueColumn);
// Create <h:outputText value="Value"> for <f:facet name="header"> of 'Value' column.
HtmlOutputText valueHeader = new HtmlOutputText();
valueHeader.setValue("Value");
valueColumn.setHeader(valueHeader);
// Create <h:outputText value="#{dataItem.value}"> for the body of 'Value' column.
HtmlOutputText valueOutput = new HtmlOutputText();
valueOutput.setValueExpression("value",
createValueExpression("#{dataItem.value}", String.class));
valueColumn.getChildren().add(valueOutput);
// Finally add the datatable to <h:panelGroup binding="#{myBean.actionDataTableGroup}">.
actionDataTableGroup = new HtmlPanelGroup();
actionDataTableGroup.getChildren().add(actionDataTable);
}