At 4:54 PM -0400 5/27/04, Kathy Zhou wrote:
How could I show 3 elements of a ArrayList per line on the page with
<c:forEach> tag.

My code is:
HashMap ilist =......;
Its value is a ArrayList of javabeans having getter/setter methods.

<c:forEach var="vissue" items="${ilist}">
c:out value="${vissue.key}"/><br>
<c:forEach var="var" items="${vissue.value.pcode}">
<c:out value="${var}"/><br> <%--- need 3 var values per line --%>
</c:forEach>
</c:forEach>


it shows me one pcode value per line on html page. But I want to show three
pcodes per line. Since there is no index number I could use (I may be
wrong) on the second <c:forEach> tag, how could I make it? Any suggestions?

Use the "varStatus" attribute of c:forEach to specify the name under which the tag will define a "LoopTagStatus" bean.


http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/c/forEach.html
http://java.sun.com/webservices/docs/1.3/api/javax/servlet/jsp/jstl/core/LoopTagStatus.html

The LoopTagStatus bean has an index property.

Joe


--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Imagine if every Thursday your shoes exploded if you tied them the usual way. This happens to us all the time with computers, and nobody thinks of complaining."
-- Jef Raskin


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to