this is a follow on from this question.. how to display 3 arraylist's in a jsp?
well i have this following code in java.. i need an equivalent one for use in jsp.. jstl codes preferred..
int i=0;
for(AuctionDo list : auctionDOList)
{
System.out.println(" "+ list.getAuctionId()+ " " + depotDolist.get(i).getDepotName() + " " + userAuctionRelDolist2.get(i).getAuctionId() );
i++;
}
the three lists are received in jsp.. thankyou.. 1 very important thing i want to display the lists in one row in a table.. so multiple foreach is out of option and tried merging the lists.. pretty much didnt work..
You have to do like this
counter keeps tracking of the iteration count variable.
Note: Since the
forEach
loop depends on the size of the first list. This will not work correctly when the size of thedepotList
oruserAuctionrelDolist
is greater than the size of the first listyou will need forEach to do this. Refer this links
http://www.tutorialspoint.com/jsp/jstl_core_foreach_tag.htm
http://www.crazysquirrel.com/computing/java/jsp/jstl-forEach.jspx
being more specific you'll need nested forEach
http://www.coderanch.com/t/288775/JSP/java/jstl-nested-foreach
http://www.roseindia.net/jsp/simple-jsp-example/NestedForEach.shtml
Something like this