-
Notifications
You must be signed in to change notification settings - Fork 0
/
body_main.jsp
57 lines (50 loc) · 2.15 KB
/
body_main.jsp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<%@ page contentType = "text/html;charset=utf-8" %>
<%@ page import = "java.util.ArrayList"%>
<%@ page import = "dto.Product"%>
<%@ page import = "dao.ProductRepository" %>
<%@ page import="java.sql.*"%>
<%! String greeting = "welcome_mejiwoo";
String tagline = "하단 페이지 : 확인"; %>
<div class = "jumbotron" style = "padding : 0; background-color : white; margin-bottom : 12px">
<hr style = "margin : 0">
<div class = "container">
<h3 class = "display-4" style = "font-size : 1rem; text-align : right; margin-top : 9px">
<%=greeting%>
</h3>
</div>
</div>
<div>
<div class = "card bg-dark text-white">
<img src="https://jsp-main--jfjgw.run.goorm.io/img/top_banner.jpeg" class = "card-img" alt = "top_img">
<div class = "card-img-overlay">
<h5 class = "card-title">MEJIWOO</h5>
<p class = "card-text">winter</p>
</div>
</div>
</div>
<div class = "container">
<div class = "row" align = "center">
<%@ include file = "db/db_conn.jsp"%>
<%
String sql = "select * from product"; // 조회
pstmt = conn.prepareStatement(sql); // 연결 생성
rs = pstmt.executeQuery(); // 쿼리 실행
while (rs.next()) { // 결과 ResultSet 객체 반복
%>
<div class = "col-md-4">
<img src = "https://jsp-main--jfjgw.run.goorm.io/img/product/<%=rs.getString("p_fileName")%>" class = "card-img" alt = "...">
<h3><%=rs.getString("p_name")%></h3>
<p><%=rs.getString("p_description")%>
<p><%=rs.getString("p_UnitPrice")%>원
<p><a href="product_detail.jsp?id=<%=rs.getString("p_id")%>" class="btn btn-secondary" role="button"> 상세 정보 »></a>
</div>
<%
} // 반복문 끝난 이후 db 연결 종료
if (rs != null)
rs.close();
if (pstmt != null)
pstmt.close();
if (conn != null)
conn.close();
%>
</div>