myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaryn Olsson" <aar...@gmail.com>
Subject difficulty implementing t:columns
Date Mon, 21 Apr 2008 20:29:10 GMT
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;
    }
}
}

Mime
View raw message