Hello all,
I was working on a Java web application, and had the following requirement with respect to looping in my HTML table.
I've a nested for loop inside a while loop(both execute the same # of times, for ex. say 3).
My code looks something like this:
<table>
<thead>...</thead>
<tbody>
if (patcases != null && patcases.size() > 0) {
Iterator itr1 = patcases.iterator();
while (itr1.hasNext()) {
..some code here..
System.out.println("DA Email from webpage..."+da.getEmail());
int rCount = 0;
<tr>
for(int i=0;i<passedValues.length; i++){
...some code here..
</tr>
System.out.println("Printed row..." +rCount);
rCount ++;
} /*closing of for loop */
}/*closing of while loop */
}/* closing of if loop */
</tbody>
</table>
Now, with this type of looping structure, I get the following on my console:
DA Email from [email protected]
Printed row...0
Printed row...1
Printed row...2
DA Email from [email protected]
Printed row...0
Printed row...1
Printed row...2
DA Email from [email protected]
Printed row...0
Printed row...1
Printed row...2
But the type of output I wanted was, something as follows:
DA Email from [email protected]
Printed row...0
DA Email from [email protected]
Printed row...1
DA Email from [email protected]
Printed row...2
How would I go about doing this?
Any help would be greatly appreciated.