segunda-feira, junho 21, 2004

webwork - Iteration Tags

http://wiki.opensymphony.com/display/WW/Iteration+Tags


Simples

<ww:iterator value="employees">
    <ww:property value="name"/> is the <ww:property value="jobTitle"/><br>
</ww:iterator>

Mais complexo

<webwork:iterator value="groupDao.groups" status="groupStatus">
    <tr class="<webwork:if test="#groupStatus.odd == true ">odd</webwork:if><webwork:else>even</webwork:else>">
        <td><webwork:property value="name" /></td>
        <td><webwork:property value="description" /></td>
        <td>
            <webwork:iterator value="users" status="userStatus">
                <webwork:property value="fullName" /><webwork:if test="!#userStatus.last">,</webwork:if>               
            </webwork:iterator>
        </td>
    </tr>
</webwork:iterator>

Um viajante ...

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

resultado será :

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

Nenhum comentário: