Bound values are not getting updated from editable datatable without setting ID in JDK1.5
Bound values are not getting updated from editable data table without setting ID in JDK 1.5. But the same does work without setting ID in JDK 1.6. Does anyone know why? Than开发者_StackOverflow中文版ks
Code, Bean part
public void setDataTable(HtmlDataTable dataTable) {
this.dataTable = dataTable;
}
public HtmlDataTable getDataTable() {
if (dataTable == null)
setEditableDataTable();
return dataTable;
}
private void setEditableDataTable() {
dataTable = new HtmlDataTable();
dataTable.setValueBinding("value",
createValuebinding("#{testBean.stringList}"));
dataTable.setVar("items");
for (int i = 0; i < getDatastable().get(i).size(); i++) {
UIColumn column = new UIColumn();
dataTable.getChildren().add(column);
HtmlOutputText header = new HtmlOutputText();
header.setValue("Header "+i);
column.setHeader(header);
HtmlInputText input = new HtmlInputText();
input.setValueBinding("value", createValuebinding("#{items[" + i
+ "]}"));
column.getChildren().add(input);
}
}
private ValueBinding createValuebinding(String valueExpression) {
return FacesContext.getCurrentInstance().getApplication()
.createValueBinding(valueExpression);
}
JSP part
<h:dataTable binding="#{testBean.dataTable}" >
</h:dataTable>
Solution
Give id for the datatable
精彩评论