CREATE TABLE `product` (
`PRODUCT_SEQ` bigint(20) NOT NULL AUTO_INCREMENT,
`CATEGORY` int NOT NULL,
`PIC` text DEFAULT 'img/1.jpg',
`TITLE` varchar(20) NOT NULL,
`PRICE` bigint NOT NULL DEFAULT 0,
`TEXT` varchar(100) DEFAULT '',
`COUNT` bigint(20) DEFAULT 0,
`PRODUCT_DEL` bigint(20) DEFAULT 0,
`USER_SEQ` bigint(20),
PRIMARY KEY (`PRODUCT_SEQ`)
) ENGINE=InnoDB AUTO_INCREMENT=97 DEFAULT CHARSET=utf8
INSERT INTO PRODUCT(CATEGORY, TITLE, PRICE, TEXT)
VALUES(1005, '달콤유자케익', 20000, '유자를 흠뻑 넣은 케익');
INSERT INTO PRODUCT(CATEGORY, TITLE, PRICE, TEXT)
VALUES(1005, '자몽이슬톡톡', 3000, '이슬 톡톡');
INSERT INTO PRODUCT(CATEGORY, TITLE, PRICE, TEXT)
VALUES(1005, '머랭쿠키', 2000, '머랭~머랭~');
<select id="getProductVOList" resultType="ProductVO">
SELECT product_seq as productSeq
, category
, pic
, title
, price
, text
, count
, product_del as productDel
, user_seq as userSeq
FROM product
</select>
public ResultMap getProductVOList(){
List<ProductVO> list = dao.getProductVOList();
ResultMap resultMap = new ResultMap();
resultMap.setStatus("200");
resultMap.put("list", list);
return resultMap;
}
@RequestMapping(value = "/list", method = RequestMethod.GET)
public String list(Model model) throws Exception {
ResultMap resultMap = service.getProductVOList();
model.addAllAttributes(resultMap);
return "product/list";
}
<h2>상세 메뉴</h2>
<div><button id="product-new-product-create" class="btn btn-info">새 상품 추가</button></div>
<div id="product-list" >
<c:forEach var = "product" items = "${list}">
<div class="row col-md-4 col-xs-12 product-elements">
<input type="hidden" value="${product.productSeq}"/>
<input type="hidden" value="${product.category}"/>
<div><img src="/resources/${product.pic}" /></div>
<div class="product-in-text">${product.title}</div>
<div class="product-in-text">${product.price}원</div>
<div class="product-in-text">${product.text}</div>
</div>
</c:forEach>
</div><!-- product-list -->
<div class="dropbtn">전체상품</div>
<div class="dropdown-content">
<a href="/product/list">디저트</a>
<a href="/product/list">이유식</a>
</div>
</div>