Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTML table to JSF table

 
lvcsta lvcsta
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Im trying to write the following html table as JSF table,


<table border="1" width="100">
<tr>
<th>
Header1
</th>
<th colspan="3" align="center">
Header2
</th>
</tr>

<tr>
<th>

</th>
<th>
Sub2 Header1
</th>
<th>
Sub2 Header2
</th>
<th>
Sub2 Header3
</th>
</tr>


<tr>
<td>
Header1 Data;
</td>
<td>
Sub2 Header1 Data1;
</td>
<td>
Sub2 Header2 Data1;
</td>
<td>
Sub2 Header3 Data1;
</td>
</tr>

<tr>
<td>
Header1 Data;
</td>
<td>
Sub2 Header1 Data2;
</td>
<td>
Sub2 Header2 Data2;
</td>
<td>
Sub2 Header3 Data2;
</td>
</tr>

</table>



Your help will be appreciated.
 
Augustine Chelliah
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could probably use panelGrid if your data is static. If you have dynamic data, use the Datatale.

By the way in your html code, I see that your second row has only 3 columns while the others have 4. I guess you have missed to add colspan attribute there. Let us know the correction and also let me know if I've understood wrong.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The key really is whether this is just static data, or whether there is a collection that contains this data that will change in size?

A JSF dataTable is designed to loop through lists or collections of objects. If your data, each row that is, can be organized into a Java object that can be thrown into a list, then you'll get the most effective use from a dataTable.



JSF Toolbox

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic