【发布时间】:2011-02-23 11:30:40
【问题描述】:
我正在尝试从数据库表中填充 JSP 下拉列表。
下面是创建数组并用数据库信息填充它的代码:
// this will create my array
public static ArrayList<DropDownBrands> getBrandsMakes() {
ArrayList<DropDownBrands> arrayBrandsMake = new ArrayList<DropDownBrands>();
while (rs.next()) {
arrayBrandsMake.add(loadOB(rs));
}
return arrayBrandsMake;
}
// this will load my array object
private static DropDownBrands loadOB(ResultSet rs) throws SQLException {
DropDownBrands OB = new DropDownBrands();
OB.setBrands("BRAN");
return OB;
}
如何从我的 JSP 中调用该类并填充下拉列表?
【问题讨论】: