-
Notifications
You must be signed in to change notification settings - Fork 1
/
MovieList.jsp
102 lines (86 loc) · 3.06 KB
/
MovieList.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page language = "java" import ="java.text.*, java.sql.*"%>
<%@ page language = "java" import = "java.util.ArrayList,javax.swing.JButton,javax.swing.ButtonGroup " %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>KNU MOVIE_TEAM3</title>
</head>
<body>
<form action="showdetail.jsp" method = "POST">
<%
String cus_id = (String)session.getAttribute("id");
String serverIP = "localhost";
String strSID = "orcl";
String portNum = "1521";
String user = "university";
String pass = "comp322";
String url = "jdbc:oracle:thin:@"+serverIP+":"+portNum+":"+strSID;
String username = "";
Connection conn = null; // Connection object
Statement stmt = null; // Statement object
ArrayList non_rate_movie = new ArrayList<Integer>();
ArrayList title = new ArrayList<String>();
ResultSet rs;
Class.forName("oracle.jdbc.driver.OracleDriver");
conn=DriverManager.getConnection(url,user,pass);
try {
conn.setAutoCommit(false);
stmt = conn.createStatement();
String sql = "SELECT title_id, title FROM MOVIE"
+ " minus"
+ " SELECT title_id, title FROM MOVIE,RATING WHERE title_id ="
+ " MT_id AND Rate_id = '"+cus_id+"'";
rs = stmt.executeQuery(sql);
int title_id;
String title_string;
while(rs.next()) {
title_id =rs.getInt(1);
non_rate_movie.add(title_id);
title_string = rs.getString(2);
title.add(title_string);
//평가하지 않은 movie들의 title_id를 arraylist non_rate_movie에 저장
}
rs.close();
}catch(SQLException ex2)
{
System.err.println("sql error = "+ex2.getMessage());
System.exit(1);
}
//사용자 이름 받아오기
try {
conn.setAutoCommit(false);
stmt = conn.createStatement();
String sql = "SELECT name FROM ACCOUNT WHERE Account_id = '"+cus_id+"'";
rs = stmt.executeQuery(sql);
while(rs.next()) {
username = rs.getString(1);
}
rs.close();
}catch(SQLException ex2)
{
System.err.println("sql error = "+ex2.getMessage());
System.exit(1);
}
out.println(username +"님 환영합니다!");
%>
<input type = "button" value = "마이페이지" onclick = "location.href = 'mypage.jsp'">
<input type = "button" value = "로그아웃" onclick = "location.href = 'Login.jsp'">
<br>
<input type = "button" value = "제목으로 검색하기" onclick = "location.href = 'SubjectSearch.jsp'" >
<input type = "button" value = "조건으로 검색하기" onclick = "location.href = 'Optionsearch.jsp'">
<input type = "button" value = "추천목록 보기" onclick ="location.href = 'recommend.jsp'" >
<%
for(int i=0; i<non_rate_movie.size();i++)
{
out.println("<br> <input type=\"radio\" name = \"title_id\" value = \""+ non_rate_movie.get(i)+"\">"+title.get(i)+"</input>");
}
session.setAttribute("cus_id",cus_id);
%>
<br>
<input type = "submit" value = "세부사항 보기" onclick = "location.href = 'showdetail.jsp'">
</form>
</body>
</html>