You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by e <li...@medusadigital.com> on 2003/08/20 22:57:38 UTC

iterating through lists in tiles

I am trying to create a list of links using items from a putList in tiles.

The end result would be:
<a href="link">item</a>
<a href="link">item</a>

How do I iterate through both link and item in parallel, so to speak?
i.e. how do I modify the code below to get the result I want?

<tiles:importAttribute/>

<logic:iterate name="items" id="item"/>
<logic:iterate name="links" id="link"/>

<html:link page="<bean:write name="link"/>"><bean:write 
name="item"/></html:link>

</logic:iterate>
</logic:iterate>


Thanks.

-eva


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: iterating through lists in tiles

Posted by Kevin Bootz <oh...@adelphia.net>.
I think you can add a bean define for the link and use it directly in a '<a
href=...' tag, such as;



<tiles:importAttribute/>

<logic:iterate name="items" id="item"/>
<logic:iterate name="links" id="link"/>

<!-- ===== link scripting var ===== -->
<bean:define id="linkName" name="link" property="pathToLink"
type="java.lang.String"/>

<a href="<%=linkName%>"><bean:write name="item"
property="someProperty"/></a>
<!-- ===== -->

</logic:iterate>
</logic:iterate>




-----Original Message-----
From: e [mailto:lists@medusadigital.com]
Sent: Wednesday, August 20, 2003 4:58 PM
To: Struts Users Mailing List
Subject: iterating through lists in tiles



I am trying to create a list of links using items from a putList in tiles.

The end result would be:
<a href="link">item</a>
<a href="link">item</a>

How do I iterate through both link and item in parallel, so to speak?
i.e. how do I modify the code below to get the result I want?

<tiles:importAttribute/>

<logic:iterate name="items" id="item"/>
<logic:iterate name="links" id="link"/>

<html:link page="<bean:write name="link"/>"><bean:write
name="item"/></html:link>

</logic:iterate>
</logic:iterate>


Thanks.

-eva


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org