I got the JSP, found below,  to work within my application for implementing
dynamic forms.  The HTML <select>'s are "named" dynamically with Struts
<bean:write>'s, all within <logic:iterate>.  The Action that handles this
form processes the HttpServletRequest, filtering for parameters names that
start with the constant values, e.g.  "withholdingAmount_".  Since the
"names" in each row of the iteration are suffixed with the same key, e.g.
countyNumber-caseNumber, the parameters can be associated and processed
accordingly in the Action.

While this works, I get the feeling I'm re-inventing the wheel.  Is there a
100% Struts technique that renders this type of dynamicism? Any thoughts are
greatly appreciated.

Thanks,

Michael Marrotte

 <logic:iterate id="payerCase" name="payer" property="payerCases">
    <app:row  oddColor="white" evenColor="#eeeeee"
styleClass="regtextdetails">
      <td align="left">
        <bean:write name="payerCase" property="countyName" filter="true"/>
      </td>
      <td align="left" nowrap>
        <bean:write name="payerCase" property="caseNumber" filter="true"/>
      </td>
      <td align="center">
        <bean:write name="payerCase" property="petitioner" filter="true"/>
      </td>
      <td align="center">
        <bean:write name="payerCase" property="respondent" filter="true"/>
      </td>
      <td nowrap>
        <select name="withholdingMonth_<bean:write name="payerCase"
property="countyNumber">-<bean:write name="payerCase"
property="caseNumber"/>">
          <option value="01">January</option>
          <option value="02">February</option>
...
        </select>/
        <select name="withholdingDay_<bean:write name="payerCase"
property="countyNumber">-<bean:write name="payerCase"
property="caseNumber"/>">
          <option value="01">1</option>
          <option value="02">2</option>
...
        </select>/
        <input type="text" name=
          "withholdingYear_<bean:write name="payerCase"
property="countyNumber" filter="true"/>-<bean:write name="payerCase"
property="caseNumber" filter="true"/>"
           size="4" maxlength="4">
      </td>
      <td align="right">
        $<input type="text" name=
"amount_<bean:write name="payerCase" property="countyNumber"/>-<bean:write
name="payerCase" property="caseNumber"/>"
        value=<bean:write name="payerCase" property="withholdingAmount"
filter="true"/> size="10" maxlength="10">
      </td>
    </app:row>
  </logic:iterate>

Reply via email to