I have a resultset like this:
year type total
2009 A 123
2009 B 223
2010 A 123
How should I display above resultset in the form of a HTML table attached.
Thanks.
Printable View
I have a resultset like this:
year type total
2009 A 123
2009 B 223
2010 A 123
How should I display above resultset in the form of a HTML table attached.
Thanks.
Do you want to do this using Java?
Yes Eranga
Could be done in many ways. But you should explain what you exactly want to do this, how, where you going to display it and so on...
You can create a string with concatenating all the required html tags to in to string. But you have to display the text in HTML support control, like a label and so on.
It needs some processing on the result set data before it get displayed.
Please make it clear, from where you are trying to generate it, like
1. As a servlet outptut
2. In a JSP page
Then it will easy for us to give solution.
Note: If you found the soulution,please share here for others.
I am generating it on a JSP page. As I loop though the arraylist that I build from DB Resultset, the problem is HTML table has to be constructed row by row. In the sense, each block below needs to be filled before I jump to the next col.
< tr>
< td>
2009
</td>
2010
< td>
</td>
</tr>
But my ArrayList is a list of Objects containing member variables as Year, Type, Total. When I loop though this list, I get all data pertaining to 2009 first and then only 2010.
Let me know if this post needs to be detailed more. Looking for some help
Did you read the post which had
"The normal way of creating tables is to create the header first (c:foreach creating <th> tags) then creating the rows in the table body (c:foreach creating <tr> tags)."
?
If you did, what did you do about it?