|
How to use iterate Tag in Struts Framework |
|
|
The iterate tag wraps content that is repeated for each element of a specified collection. The collection can be any of the following:
- An array of java Objects or primitives.
- An implementation of java.util.Collection.
- An implementation of java.util.Iterator.
- An implementation of java.util.Map.
There are three ways you can specify which collection to iterate over, as listed here.
- You can use the collection attribute to specify a scriptlet that evaluates to a collection object.
<logic:iterate id="output" collection="<%=outputs%>"
Output is <%=output%><br>
</logic:iterate>
|
- You can use the name attribute to specify the name of a collection object that can be in any scope or limited to a specific scope with the scope attribute.
<logic:iterate id="output" name="outputs">
Output is <bean:write name="output"/><br>
</logic:iterate>
|
- You can use the name and property attributes in tandem to specify the name of a collection object and its field whose getter method will be called to return a collection object.
<logic:iterate id="output" name="searchObject" property="outputs">
Output is <bean:write name="output"/><br>
</logic:iterate>
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.