我想从mysql数据库中获取位置名称。我想检索所有位置名称并收集到ArrayList
和此列表请求setAttribute
到jsp。将String []转换为ArrayList
ArrayList<Bean> SupplyLocation = new ArrayList<Bean>();
try {
//...
while(rs.next()) {
Bean Location = new Bean();
String supply[] = (rs.getString("location_name")).split(",");
for(int i=0; i<supply.length; i++) {
Location.setLocation(supply);
SupplyLocation.add(Location);
}
}
}
这不会编译... –