Found out what is happening here. Basically on my initial page load,
there was no data for the table. Now when I select some other entries
and click on a button, it is refreshing the page, but the table still
shows the old data (in this case, nothing). I tried the default so that
some data shows up and after resubmitting with different data, it
doesn't refresh. Can this problem be solved? I need the fix by Mon as I
need to demo this to our team.
thanks
Karam
Karam Singh Badesha wrote:
> 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