wood burning stoves*
The moose likes JSF and the fly likes Help needed in generating table from java class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Help needed in generating table from java class" Watch "Help needed in generating table from java class" New topic
Author

Help needed in generating table from java class

Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108
code in jsp page

<tr:table width="100%" id="internalTab" binding="#{forceMatchNewRequest.tableInternal}" >

line of codes in java class

private ArrayList<ArrayList> tableValueInternal;
private ArrayList<ArrayList> tableValueExternal;
private ArrayList<String> columnHeader;

tableValueInternal = new ArrayList<ArrayList> ();
tableValueExternal = new ArrayList<ArrayList> ();
columnHeader = new ArrayList<String> ();
columnHeader.add("RNLegder No.");
columnHeader.add("Security Description");
columnHeader.add("Trade Date");
columnHeader.add("Buy/Sell");
columnHeader.add("Ref Num");
columnHeader.add("Currency");
columnHeader.add("Quantity");
columnHeader.add("Trade Price");
columnHeader.add("Give In Charge");

//populating column data
ArrayList<String> columnData = new ArrayList<String> ();
columnData.add("M1ZBLU");
columnData.add("DEC 08 OSE NIKKEI 225");
columnData.add("23-Feb-2009");
columnData.add("B");
columnData.add("8KJH KNf0");
columnData.add("USD");
columnData.add("100");
columnData.add("12000");
columnData.add("0");

ArrayList<String> columnData1 = new ArrayList<String> ();
columnData1.add("A68523");
columnData1.add("NOV 08 HS INDEX");
columnData1.add("11-Mar-2009");
columnData1.add("S");
columnData1.add("8KJA Gjc");
columnData1.add("GBP");
columnData1.add("20");
columnData1.add("13876");
columnData1.add("-100");

tableValueInternal.add(columnData);
tableValueExternal.add(columnData1);

//Populating table(internal) itself
tableInternal = new CoreTable ();
CoreColumn column = null;
for (int i = 0; i < columnHeader.size(); i++) {

column = new CoreColumn ();
column.setParent(tableInternal);
column.setHeaderText(columnHeader.get(i));
for (int j = 0; j < tableValueInternal.size(); j++ ) {

column.setSeparateRows(true);
ArrayList<String> columnValue = tableValueInternal.get(j);
CoreOutputText text = new CoreOutputText();
text.setParent(column);
text.setValue(columnValue.get(i));
column.getChildren().add(text);
// column.setRendered(true);
}
tableInternal.getChildren().add(column);
}
//Populating table(external) itself
tableExternal = new CoreTable ();
CoreColumn column1 = null;
for (int i = 0; i < columnHeader.size(); i++) {

column1 = new CoreColumn ();
column1.setParent(tableExternal);
column1.setHeaderText(columnHeader.get(i));
for (int j = 0; j < tableValueExternal.size(); j++ ) {

column1.setSeparateRows(true);
ArrayList<String> columnValue = tableValueExternal.get(j);
CoreOutputText text = new CoreOutputText();
text.setParent(column1);
text.setValue(columnValue.get(i));
column1.getChildren().add(text);
// column1.setRendered(true);
}
tableExternal.getChildren().add(column1);
}

i am not able to view the table. well sometime while refreshing the page i m able to see column headers but not the data.
Any help would be highly helpful


Regards,
Gaurav
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Help needed in generating table from java class