dev@jsftemplating.java.net

Table data not showing up

From: Karam Singh Badesha <Karam.Badesha_at_Sun.COM>
Date: Fri, 26 Jan 2007 16:23:10 -0800

Hi,
Here is the what I had when the code was working fine:

Table data was hardcoded in the handler was passing a list of
HashTable/Map entries. The values is passed back and set as a
pageSession variable. Here is corresponding jsf code:

<sun:tableRowGroup
                    id="rowGroup1"
                    data={"$pageSession{table1DataList}"}
                    sourceVar="tRow"
>

Now, I am getting the data from the database in the handler and can
print the data fine in the handler, so I am assuming the data is getting
fed into the same list of HashTable/Map entries fine. But nothing is
showing up on the Table. Any idea why this might be happening?

Here is the corresponding handler code:

    @Handler(id="getTable1Data",
    input={
        @HandlerInput(name="lavaVersion", type=String.class),
        @HandlerInput(name="buildVersion", type=String.class),
        @HandlerInput(name="lavaProject", type=String.class)},
    output={
        @HandlerOutput(name="table1Data", type=java.util.List.class)
    })
    public static void fetchTable1Data(HandlerContext context) {
       
        System.out.println("In fetchTable1Data...");
        String lava = (String) context.getInputValue("lavaVersion");
        String build = (String) context.getInputValue("buildVersion");
        String project = (String) context.getInputValue("lavaProject");
        List t1Data = new ArrayList();
       
        try {
            System.out.println("In fetchTable1Data try block...");
            DataAccessLayer dal = new DataAccessLayer();
            CachedRowSetImpl crs = dal.getFirstLevelUsageStats(lava,
build, project);
            RowSetMetaDataImpl rsmd = (RowSetMetaDataImpl)
crs.getMetaData();
            int count = rsmd.getColumnCount();
            System.out.println("Column count is: " + rsmd.getColumnCount());
            int rows = 0;
           
            while(crs.next()) {
                System.out.println("In while loop: " + rows);
                Map rEntries = new Hashtable();
                for(int i=1;i<=count;i++)
                {
                   System.out.println(crs.getObject(i));
                   rEntries.put("col" +i, crs.getObject(i).toString());
                }
                t1Data.add(rows,rEntries);
                rows++;
            }
            System.out.println("Table rows: " + rows);
        } catch(SQLException e) {
            e.printStackTrace();
        }
       
        // Set the output.
        context.setOutputValue("table1Data", t1Data);
    }

thanks
Karam