You have to use an indexed tag (available in nightly build, or you can do same
thing via scriptlets) so that the index of the collection is added to the name
of the checkbox - eg ListMitgliederSelektionForm[0].selected.  You also need to
add a
getListMitgliederSelektionForm(int i) in the array, which returns the bean at
index i.

Hope that helps,

Dave





"Roland Berger" <[EMAIL PROTECTED]> on
10/23/2001 08:06:59 AM

Please respond to [EMAIL PROTECTED]

To:   "Struts Mailinglist"
      <[EMAIL PROTECTED]>
cc:    (bcc: David Hay/Lex/Lexmark)
Subject:  populate checkbox back to frombean



Hi all

I have searched the mailinglist for the following problem but did not find
the answer:

How is it possible to populate the state of a checkbox (checked or
unchecked) back to the corresponding property in the formbean when the user
clicks the submit button. The formbeans are stored in an ArrayList.

I have several formbeans  (same bean type) stored in an array  called
"Mitglieder". One property of the formbean is called: "selected"
In the JSP page I have the following:

<table>
  <logic:iterate id="ListMitgliederSelektionForm" name="Mitglieder">
    <tr>
       <td><bean:write name="ListMitgliederSelektionForm"
property="fanum"/></td>
       <td><bean:write name="ListMitgliederSelektionForm"
property="mitnum"/></td>
       <td><bean:write name="ListMitgliederSelektionForm"
property="titel"/></td>
       <td><bean:write name="ListMitgliederSelektionForm" property="name"/></td>
       <td><bean:write name="ListMitgliederSelektionForm"
property="vorname"/></td>
       <td><bean:write name="ListMitgliederSelektionForm" property="plz"/></td>
       <td><bean:write name="ListMitgliederSelektionForm" property="ort"/></td>
       <td><bean:write name="ListMitgliederSelektionForm" property="land"/></td>
       <td>
        <html:checkbox property="selected"
name="ListMitgliederSelektionForm" value="true"/>
       </td>
    </tr>
  </logic:iterate>

Can struts handle this. If not how can I do that in an elegant way?


Roland Berger







Reply via email to