You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Aaryn Olsson <aa...@gmail.com> on 2008/04/21 22:29:10 UTC
difficulty implementing t:columns
Hello,
I am having difficulty implementing t:columns and keep getting this error
message (using either MyFaces 1.2.2 or JSF 1.2_07).
java.lang.IllegalStateException: UIColumns component must be a child
of a UIData component
I've attached my JSP and my backing bean. What am I missing here?
testColumns.jsp
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<f:view>
<html>
<head><title>Simple jsp page</title></head>
<body>
<t:dataTable
value="#{TestColumnsBean.rows}"
var="row"
preserveDataModel="true" >
<t:columns
value="#{row.data}"
var="column">
<h:outputText value="#{column}"/>
</t:columns>
</t:dataTable>
</body>
</html>
</f:view>
this is my backing bean:
import java.util.ArrayList;
import java.util.List;
public class TestColumnsBean {
private List<TestRow> rows;
public TestColumnsBean() {
rows=new ArrayList<TestRow>();
for (int i=0; i<4; i++)
{
rows.add(new TestRow(i^2));
}
}
public List<TestRow> getRows() {
return rows;
}
public void setRows(List<TestRow> rows) {
this.rows = rows;
}
public class TestRow {
private static Logger logger =
Logger.getLogger(TestRow.class.getName());
private List<Long> data;
public TestRow(long start) {
data=new ArrayList<Long>();
for (int i=0; i<5; i++)
data.add(start+i);
}
public List<Long> getData() {
return data;
}
public void setData(List<Long> data) {
this.data = data;
}
}
}