Notice
Recent Posts
Recent Comments
Link
«   2025/03   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
Archives
Today
Total
관리 메뉴

개발자

list에 map 넣기 본문

개발자/JSP

list에 map 넣기

GoGo개발 2022. 9. 28. 11:10

<abstractcontrollor>

 

 

InterProductDAO pdao = new ProductDAO();
List<HashMap<String, String>> categoryList = pdao.getCategoryList();

//tbl_category 테이블에서 카테고리 대분류 번호(cnum), 카테고리코드(code), 카테고리명(cname)을 조회해오기
// VO를 사용하지 않고 Map 으로 처리해보겠습니다.
request.setAttribute("categoryList", categoryList);

 

 

<DAO>

 

while(rs.next()) {

HashMap<String, String> map = new HashMap<>();
map.put("cnum", rs.getString(1));
map.put("cnum", rs.getString(2));
map.put("cnum", rs.getString(3));

categoryList.add(map);