How can I create dynamic datatable in backing bean in jsf (visual jsf)?

I have to create dataTable in jsf in netBeans 6.5.1 (visual jsf, appServer=glassfish, os=windows xp).
I receive data dynamically from web service....
I don't know how many column, nor number of rows I would have.
And I have to do that in prerender() method of that page, because when someone click link, I have to display that page.
Now, in my jsp, I have tag for dataTable (h:dataTable) with some properties (not column-tag there).
And in java file of that jsp (backing bean) in prerender method I can get name of column and style of column (I put code down)...
Data for properties of column are in my headers variable and in my rows variable are data for rows.
My problem is how can I add data (rows) to my table; map data to my table?
Hope you can help me...

----------------> TableGeneric.jsp:
... <h:dataTable binding="#{webs$TableGeneric.dataTable1}" headerClass="list-header" id="dataTable1"  rowClasses="list-row-even,list-row-odd" value="#{webs$TableGeneric.dataTable1Model}">
 </h:dataTable>...
----------------> TableGeneric.java: ...
private HtmlDataTable dataTable1 = new HtmlDataTable(); 
....
public void prerender(){...
   List<HeaderFieldDefinition> header;
   Map<Integer, Map<String, RowField> > rows;
 
   UIColumn column;
   List<UIComponent> childrenList = dataTable1.getChildren();
   childrenList.clear();
   HtmlOutputText headerPrint;
   try{
        /*in tableData there are data and I have everything but I don't actually know write rows in data */
          header = tableData.getHeader();
          rows = tableData.getRows();
 
//in this for loop, I get what I need for name of column, style, etc and via getChildren() and add() //method I map that to a table; but I don't know do that with row 
          for(HeaderFieldDefinition hfd : header){
                column  = new UIColumn();
                headerPrint = new HtmlOutputText();
                headerPrint.setValue(hfd.getName());
                headerPrint.setStyleClass(hfd.getStyleClass());
                column.setHeader(headerPrint);
                childrenList.add(column);
              }
 
//I do something like this for rows, but it's not quite ok:
      int i = childrenList.size();
      
//this is not good: in tempList remember all data like Html...I think that is my problem; I need //something else, I think?!
      List<HtmlOutputText> tempList = new ArrayList<HtmlOutputText>();
      HtmlOutputText row;
 
      Iterator it = rows.entrySet().iterator();
      int p =0;
      while (it.hasNext()) {
             Map<String, RowField> innerMap;
             innerMap = (Map<String, RowField>) ((Map.Entry)it.next()).getValue();
             Iterator iter = innerMap.entrySet().iterator();
             RowField rowField;
             while (iter.hasNext()) {
                    Map.Entry pairs = (Map.Entry)iter.next();
                    rowField = (RowField) pairs.getValue();
                    row = new HtmlOutputText();
                    row.setValue(rowField.getValue());
                    tempList.add(row);
              }
              for(int j = 0; j < i; j++){
                        (childrenList.get(j)).getChildren().add(tempList.get(j));
               }
               p++;
       }
//here I have tempList fill with data and I know there is p rows and i columns...and what now
//System.out.println("--------------> p = "+p + "; i = "+i + "; tempList.size()" + tempList.size());
...}

Open in new window

iceberg100Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

iceberg100Author Commented:
I don't know if I ask understandable question.....
I want to know if I have a list of HtmlOutputData, how can I put that in a row field; each element of the list in one place in row?
Or if you have better idea, please?
0
iceberg100Author Commented:
I did it....
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.