struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Germuska <...@Germuska.com>
Subject Re: <c:forEach> presentation tag
Date Thu, 27 May 2004 21:15:58 GMT
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            
Joe@Germuska.com  
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message