-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.jsp
80 lines (80 loc) · 2.95 KB
/
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>메인화면</title>
<style type="text/css">
.recommend {
margin: 0 auto;
padding: 50px;
}
.product {
padding: 10px;
width: 220px;
background-color: white;
float: left;
}
</style>
</head>
<body>
<%@ include file="dbconn.jsp" %>
<%@ include file="header.jsp" %>
<%
String sql = "select * from board where readcount = (select max(readcount) from board)";
PreparedStatement pstmt = conn.prepareStatement(sql);
ResultSet rs = pstmt.executeQuery();
rs.next();
%>
<div class="recommend">
<h2>추천 상품</h2>
<div class="product">
<table>
<tr><td><a href="contentRead.jsp?board=1&num=<%=rs.getInt("num") %>"><img width='200px' height='200px' onerror="this.src='./image/Default.png'" src='<%="./image/" + rs.getString("filepath") %>'></a></td></tr>
<tr><td><a href="contentRead.jsp?board=1&num=<%=rs.getInt("num") %>"><%=rs.getString("subject") %></a></td></tr>
<tr><td><%=rs.getInt("price") %><b>원</b></td></tr>
</table>
</div>
<%
sql = "select * from board where num = (select max(num) from board)";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
rs.next();
%>
<div class="product">
<table>
<tr><td><a href="contentRead.jsp?board=1&num=<%=rs.getInt("num") %>"><img width='200px' height='200px' onerror="this.src='./image/Default.png'" src='<%="./image/" + rs.getString("filepath") %>'></a></td></tr>
<tr><td><a href="contentRead.jsp?board=1&num=<%=rs.getInt("num") %>"><%=rs.getString("subject") %></a></td></tr>
<tr><td><%=rs.getInt("price") %><b>원</b></td></tr>
</table>
</div>
<%
sql = "select * from board2 where num = (select max(num) from board2)";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
rs.next();
%>
<div class="product">
<table>
<tr><td><a href="contentRead.jsp?board=2&num=<%=rs.getInt("num") %>"><img width='200px' height='200px' onerror="this.src='./image/Default.png'" src='<%="./image/" + rs.getString("filepath") %>'></a></td></tr>
<tr><td><a href="contentRead.jsp?board=2&num=<%=rs.getInt("num") %>"><%=rs.getString("subject") %></a></td></tr>
<tr><td><%=rs.getInt("price") %><b>원</b></td></tr>
</table>
</div>
<%
sql = "select * from board2 where readcount = (select max(readcount) from board2)";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
rs.next();
%>
<div class="product">
<table>
<tr><td><a href="contentRead.jsp?board=2&num=<%=rs.getInt("num") %>"><img width='200px' height='200px' onerror="this.src='./image/Default.png'" src='<%="./image/" + rs.getString("filepath") %>'></a></td></tr>
<tr><td><a href="contentRead.jsp?board=2&num=<%=rs.getInt("num") %>"><%=rs.getString("subject") %></a></td></tr>
<tr><td><%=rs.getInt("price") %><b>원</b></td></tr>
</table>
</div>
</div>
</body>
</html>