This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
The most obvious difference between the two images is that columns and rows have been transposed.
Currently you have two nested loops
For each database column
For each database row
output the value in this column/row
I would suggest that you reverse these loops
For Each database row
For each database column
Output the value in this row/column
If you do it in that manner, you should only need one query rather than two, as iterating rows then columns is the natural access for a database query.
Think about what you want to output when a value is null.
Also, if you've read any other posts in this forum, you will have discovered
- java code in a JSP is frowned upon. Java code belongs in a java class. Use JSTL/EL in JSPs
- sql code does not belong in a JSP. You should run the query, load the results into a java data structure (e.g. List of objects) , and then pass that List to your JSP to display.
Rakesh Keerthi
Ranch Hand
Joined: Jul 16, 2012
Posts: 103
posted
0
Hi Bear and Stefan,
i've fixed it it was actually a formatting problem. your tips helped me. And below is the code(a reference, just in case if anybody faces the similar issue).