如何在同一 jsp 页面中的另一个组合框的选定索引更改事件上将数据库值添加到我的组合框()中,请快速帮助.......
这是我的代码
<tr>
<td>Item</td>
<td>
<select name="cboItems" id="cboItems">
<option value="-1">--Select--</option>
<%
CommodityInfoActions comObj = new CommodityInfoActions(erpConn);
comObj.getAllRecords();
Iterator itr = comObj.ListOfObjects.iterator();
int i = 1;
while (itr.hasNext()) {
CommodityInfo newObj = (CommodityInfo) itr.next();
String item = newObj.getCommodityName();
long itemid = newObj.getId();
out.println("<option value='" + itemid + "' >" + item + "</option>");
i++;
}
%>
</select>
</td>
</tr>
<tr>
<td>Batch No. </td>
<td>
<select id="cboBatchNo">
<option>--select--</option>
<%
try {
if (Long.parseLong(request.getParameter("cboItems")) > -1) {
CommodityPriceActions comp = new CommodityPriceActions(erpConn);
comp.getBatchno(Long.parseLong(request.getParameter("cboItems")));
CommodityPrices comPrice = new CommodityPrices();
itr = comp.ListOfObjects.iterator();
i = 1;
while (itr.hasNext()) {
CommodityPrices newObj = (CommodityPrices) itr.next();
out.println("<option value='" + newObj.getId() + "'>" + newObj.getBatchNo() + "</option>");
}
}
} catch (Exception exc) {
}
%>
</select>
</td>
</tr>
我想在运行时根据 cboItems 中选择的选项更改 cboBatchno 的内容...