segunda-feira, junho 21, 2004

webwork - Iteration Tags

Confluence - Iteration Tags
Confluence - Iterator tag examples
--
Integaringo e obtendo status da lista

<ww:bean name="com.opensymphony.webwork.example.IteratorExample" id="it">
<ww:param name="day" value="'foo'"/>
<ww:param name="day" value="'bar'"/>
</ww:bean>

<table border="0" cellspacing="0" cellpadding="1">
<tr>
<th>Days of the week</th>
</tr>

<ww:iterator value="#it.days" status="rowstatus">
<tr>
<ww:if test="#rowstatus.odd == true">
<td style="background: grey"><ww:property/></td>
</ww:if>
<ww:else>
<td><ww:property/></td>
</ww:else>
</tr>
</ww:iterator>
</table>
--
Interagindo numa lista de objetos
<ww:iterator value="employees"> <ww:property value="name"/> is the <ww:property value="jobTitle"/><br> </ww:iterator>

--

<ww:iterator value="countries"> <ww:iterator value="cities"> <ww:property value="name"/>, <ww:property value="[1].name"/><br> </ww:iterator> </ww:iterator>

Resultado será algo como:

Wellington, New Zealand
Auckland, New Zealand
Moscow, Russia
Glasgow, Scotland
Edinburgh, Scotland
Stockholm, Sweden

Nenhum comentário: