I mean your example *displays* an array. Let's say I change your example
and instead of displaying an array I want to *edit* all elements in the
array and post the results up to struts. Here is a JSP struts example of
what we do:

<html:form action="/app/saveEmployment.act">
<table align=center border=3 borderColor=#ffffff borderColorDark=#000000
borderColorLight=#ffffff frame=void height=390 rules=rows style="HEIGHT:
190px; LEFT: 0px; TOP: 10px; WIDTH: 700px" width=700>
  <tr>
    <th align="left"> Employee Id </td>
    <td align="left"> Client Id </td>
    <td align="left"> Work Zip Code </td>
    <td align="left"> Mail code </td>
    <td align="left"> Delete </td>
  </tr>
  <%EmploymentForm empForm=(EmploymentForm)request.getAttribute
("employmentForm");%>
  <%for (int i=0; i < empForm.getData().getRows().length;i++) {%>
  <tr>
    <td align="left">
      <input type="text" name="data.rows[<%=i%>].empEmployeeId"
maxlength=10 size=10/ value="<%=empForm.getData().getRows
()[i].getEmpEmployeeId()%>">
    </td>
    <td align="left">
      <input type="text" name="data.rows[<%=i%>].cltClientId" maxlength=10
size=10/ value="<%=empForm.getData().getRows()[i].getCltClientId()%>">
    </td>
    <td align="left">
      <input type="text" name="data.rows[<%=i%>].workZipcode" maxlength=10
size=10/ value="<%=empForm.getData().getRows()[i].getWorkZipcode()%>">
    </td>
    <td align="left">
      <input type="text" name="data.rows[<%=i%>].mailcode" maxlength=10
size=25/ value="<%=empForm.getData().getRows()[i].getMailcode()%>">
    </td>
    <td align="left">
      <input type="checkbox" name="markedForDelete[<%=i%>]">
    </td>
  </tr>
  <%}%>
  <tr>
    <td align="left"> </td>
    <td align="left"> </td>
    <td align="left"> </td>
    <td align="left"> </td>
    <td align="left"> </td>
  </tr>
</table>
<table align="center">
  <td align="right"> <html:submit> <bean:message key="button.save"/>
</html:submit>
  </td>
  <td align="left"> <html:reset> <bean:message key="button.reset"/>
</html:reset>
    &nbsp; <html:cancel> <bean:message key="button.cancel"/> </html:cancel>
</td>
</table>
</html:form>


We go outside the struts tags here because in the 1.0 version the iterate
tag does not do this properly ( but the struts engine does ). Note in the
above how elements are generated as index ( [n] ) elements. The
ActionForm's would contain indexed properties in order for this to work.


What would the velocity equivalent of the above look  like?




_______________________
Will Spies
Towers Perrin
Phone: (215)246-7145
e-mail: [EMAIL PROTECTED]


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

Reply via email to