The ForEach servlet bean lets you iterate over the elements of an array property, and specify the desired HTML for displaying 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>
  <ul>
  <dsp:oparam name="output">
    <li><dsp:valueof param="element"></dsp:valueof></li>
  </dsp:oparam>
  </ul>
</dsp:droplet>

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices