On 3/2/06, Rutherford, Matthew <[EMAIL PROTECTED]> wrote:
> Hi
> I'm creating a dynamic form that has multiple checkboxes on it, one for each
> record returned from a database.
> I understand the iterator is what is normally used for dynamic forms.  What
> I am unsure about is how you use iterator whilst also spewing out each db
> record's info (name, etc etc) into a html table?
>
> Im sure this has been covered before but I can't seem to find explicit code
> samples.

For example (this is a mix of Struts-EL and JSTL, so make adjustments
that you need):

  <table>

    <%-- Table header --%>
    <thead>
      <tr>
        <th><bean:message key="heading.host"/></th>
        <th><bean:message key="heading.user"/></th>
        <th><bean:message key="heading.type"/></th>
        <th><bean:message key="heading.autoConnect"/></th>
        <th><bean:message key="heading.action"/></th>
      </tr>
    </thead>

    <%-- Iterate over subscription list --%>
    <logic-el:iterate id="subscription"
                      collection="${SubscriptionForm.subscriptions}"
                      offset="${SubscriptionForm.offset}"
                      length="${SubscriptionForm.pagesize}"
                      type="net.jspcontrols.mailreader.business.Subscription">
      <tr>
        <!-- Subscription data -->
        <td><c:out value="${subscription.host}"/></td>
        <td><c:out value="${subscription.username}"/></td>
        <td><c:out value="${subscription.type}"/></td>
        <td><c:out value="${subscription.autoConnect}"/></td>

        <%-- Operations on each subscription: update and delete by host --%>
        <td>
          <html-el:link
            href="SubscriptionsInput.do?updateEvent&host=${subscription.host}">
            <bean:message key="registration.editSubscription"/>
          </html-el:link> |
          <html-el:link
            href="SubscriptionsInput.do?deleteEvent&host=${subscription.host}">
            <bean:message key="registration.deleteSubscription"/>
          </html-el:link>
        </td>
      </tr>
    </logic-el:iterate>
  </table>

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to