The ForEach servlet bean lets you iterate over the elements of an array property, and specify the desired HTML to display each element. ForEach also provides these options:

  • Specify the HTML to display before and after array processing,

  • Specify the HTML to display if the array has no elements.

For example, the following JSP fragment uses the ForEach servlet bean to loop through the elements in the array property Student_01.subjects:

<dsp:droplet name="/atg/dynamo/droplet/ForEach">
  <dsp:param name="array" bean="/samples/Student_01.subjects"/>
  <dsp:oparam name="outputStart">
    <p>The student is registered for these courses:</p>
  <dsp:oparam name="output">
    <li><dsp:valueof param="element"></dsp:valueof></li>
loading table of contents...