List中值是null,不知道怎么取到值。。。
JAVA CODE:
List listBrand = new ArrayList();
while(rs.next()){
BrandVO brand = new BrandVO();
brand.setId(rs.getInt("id"));
brand.setBname(rs.getString("name"));
listBrand.add(brand);
}
req.setAttribute("carList", rs.getInt("id"));
req.getRequestDispatcher("add_car.jsp").forward(req, resp)
jsp中代码:
<%
List<BrandVO> listBrand = (List) request.getAttribute("carList");
for(BrandVO brand : listBrand){
%>
<option><%=brand.getBname()%></option>
<% }%>