这是我的 JSP。
<form:form action="changeSrtOrdrRecoveryAccount.do" id="sortOvrlyFrm" autocomplete="off">
<c:if test="${not empty recoveryAccts}">
<ng:dep-datatable stretch="true" xstyle="border:0">
<ng:dep-datatable-tr xstyle="border:0;background-color:#FFFFFF;">
<ng:dep-datatable-th xstyle="border:0"><fmt:message key="label.rcvyAcct"/></ng:dep-datatable-th>
<ng:dep-datatable-th xstyle="border:0">Sort Order</ng:dep-datatable-th>
</ng:dep-datatable-tr>
<c:forEach items="${recoveryAccts }" var="recAcct">
<ng:dep-datatable-tr xstyle="border:0">
<ng:dep-datatable-cell xclass="borderlessTableCell">
<input type="text" name="recAcct" value="<c:out value="${recAcct}"/>" readonly="readonly" />
</ng:dep-datatable-cell>
<ng:dep-datatable-cell xclass="borderlessTableCell">
<select name="srtOption">
<option value="<c:out value="${recAcct}-0"/>">0</option>
<c:forEach var="i" begin="1" end="${total}" step="1" varStatus ="status">
<option value="<c:out value="${recAcct}"/>-<c:out value="${i}"/>"><c:out value="${i}"/></option>
</c:forEach>
</select>
</ng:dep-datatable-cell>
</ng:dep-datatable-tr>
</c:forEach>
</ng:dep-datatable>
</c:if>
</form:form>
这是我生成的代码。我正在寻找一种方法来为第一个帐户的 srtOption 分配和显示值 1,为第二个帐户分配和显示 2 的值。使用当前代码,0 将显示在 srtOption 下拉列表中两个帐户。如果我像下面这样添加选择,那么下拉列表中显示的两个帐户的值都是 2。
<option selected value="<c:out value="${recAcct}"/>-<c:out value="${i}"/>"><c:out value="${i}"/></option>
q
<table style="border:0" class="wt-ng-dt-dep wt-ng-dt-dep-stretch" cellpadding="0" cellspacing="0">
<tr style="border:0;background-color:#FFFFFF;" class="wt-ng-dt-dep-tr wt-ng-dt-dep-tr-header">
<th style="border:0" class="wt-ng-dt-dep-th">Recovery Account</th>
<th style="border:0" class="wt-ng-dt-dep-th">Sort Order</th>
</tr>
<tr style="border:0" class="wt-ng-dt-dep-tr">
<td class="borderlessTableCell wt-ng-dt-dep-cell wt-ng-dt-dep-cell-first">
<input type="text" name="recAcct" value="1234567891234 - 1" readonly="readonly" />
</td>
<td class="borderlessTableCell wt-ng-dt-dep-cell wt-ng-dt-dep-cell-first">
<select name="srtOption">
<option value="1234567891234 - 1-0">0</option>
<option selected value="1234567891234 - 1-1">1</option>
<option selected value="1234567891234 - 1-2">2</option>
</select>
</td>
</tr>
<tr style="border:0" class="wt-ng-dt-dep-tr">
<td class="borderlessTableCell wt-ng-dt-dep-cell">
<input type="text" name="recAcct" value="9876543219876 - 2" readonly="readonly" />
</td>
<td class="borderlessTableCell wt-ng-dt-dep-cell">
<select name="srtOption">
<option value="9876543219876 - 2-0">0</option>
<option selected value="9876543219876 - 2-1">1</option>
<option selected value="9876543219876 - 2-2">2</option>
</select>
</td>
</tr>
</table>
谢谢你们对此的任何帮助