The iterate tag wraps content that is repeated for each element of a specified collection. The collection can be any of the following:

  1. An array of java Objects or primitives.
  2. An implementation of java.util.Collection.
  3. An implementation of java.util.Iterator.
  4. An implementation of java.util.Map.

There are three ways you can specify which collection to iterate over, as listed here.

  1. You can use the collection attribute to specify a scriptlet that evaluates to a collection object.

  2. <logic:iterate id="output" collection="<%=outputs%>"
    Output is <%=output%><br>

  3. 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.

  4. <logic:iterate id="output" name="outputs">
    Output is <bean:write name="output"/><br>

  5. 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.

  6. <logic:iterate id="output" name="searchObject" property="outputs">
    Output is <bean:write name="output"/><br>