好的......它的一个长问题。但我认为答案很简单。尽管我自己找不到解决方案。 t在jsp页面中有四行。我想在页面中添加10多行使用循环的字段将有名称像在jsp页面中创建动态行
row1_amount, row1_loantype,row1_date, row1_status
row2_amount, row2_loantype,row2_date, row2_status
等等。
更清楚
property="cib_borrower_report.loanType"
将在表单中的所有十行。
property="cib_borrower_report.loanType1"
property="cib_borrower_report.loanType2"
property="cib_borrower_report.loanType3"
现在,如果我想使用循环做这个命名如何做到这一点?我如何添加1,2,3 ..属性?
如果我可以动态地做到这一点,它将帮助我获取值的类型。所以请帮助。
<table border="0" cellpadding="1"><tbody>
<tr>
<td ><label class="desc"><bean:message key="label.cib.new.report.taken.amount"/></label></td>
<td><html:text property="cib_borrower_report.takenAmount" styleClass="SingleLineTextField" size="20"></html:text></td>
<td> </td>
<td><label class="desc"><bean:message key="label.cib.new.report.loan.type"/></label></td>
<td><html:text property="cib_borrower_report.loanType" styleClass="SingleLineTextField" size="20"></html:text></td>
<td> </td>
<td><label for="cib_borrower_report.reportingDate" class="desc"><bean:message key="label.cib.new.reporting.date" /></label></td>
<td>
<table><tbody><tr>
<td><input type="Text" name="cib_borrower_report.reportingDate" id="cib_borrower_report.reportingDate" style="cib_borrower_report.reportingDate" class="SingleLineTextField" maxlength="10" size="10" tabindex="1" ></td>
<td><a href="javascript:NewCal('cib_borrower_report.reportingDate','mmddyyyy')"><img align="middle" src="Images/cal.jpg" width="20" height="20" border="0" alt="Pick a date"></a></td>
</tr></tbody></table>
</td>
<td> </td>
<td><label class="desc"><bean:message key="label.cib.new.loan.status"/></label></td>
<td align="center">
<html:select property="cib_borrower_report.loanStatus" styleId="searchQuery1">
<html:option value="STD">STD</html:option>
<html:option value="SMA">SMA</html:option>
<html:option value="SS">SS</html:option>
<html:option value="DF">DF</html:option>
<html:option value="BL">BL</html:option>
</html:select>
</td>
</tr>
</tbody></table>
我明白你的答案。但我是jsp的新手。如果你给我一个例子,这将是有益的 – riyana 2010-09-05 07:30:52