You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Rutherford, Matthew" <Ma...@DrKW.com> on 2006/03/02 15:02:48 UTC

dynamic form tags

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.
 
thanks
 
Matthew Rutherford
Digital Markets - Research team
Dresdner Kleinwort Wasserstein
 
+44 (0) 20 7475 2523
 


--------------------------------------------------------------------------------
The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express
written permission of the sender. If you are not the intended recipient, please
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender. 3167
--------------------------------------------------------------------------------


Re: dynamic form tags

Posted by Michael Jouravlev <jm...@gmail.com>.
On 3/2/06, Rutherford, Matthew <Ma...@drkw.com> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org