-
Notifications
You must be signed in to change notification settings - Fork 1
/
select.jsp
66 lines (49 loc) · 1.61 KB
/
select.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
<%@ page contentType="text/html; charset=EUC-KR" %>
<%@ page import="java.sql.*" %>
<html><head><title>수강신청 입력</title></head>
<body>
<%@ include file="top.jsp" %>
<% if (session_id==null) response.sendRedirect("login.jsp"); %>
<table width="75%" align="center" border>
<br>
<tr><th>과목번호</th><th>분반</th><th>과목명</th><th>학점</th>
<th>수강신청</th></tr>
<%
Connection myConn = null;
Statement stmt = null;
String mySQL = null;
String dburl = "jdbc:oracle:thin:@localhost:1521:orcl";
String user = "db01";
String passwd = "ss2";
String jdbc_driver = "oracle.jdbc.driver.OracleDriver";
ResultSet myResultSet;
String c_id="";
int c_id_no;
String c_name;
int c_unit;
try {
Class.forName(jdbc_driver);
myConn = DriverManager.getConnection (dburl, user, passwd);
stmt = myConn.createStatement();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
mySQL = "select c.c_id, c_name, c.c_id_no from enroll e, course c where e.c_id=c.c_id and e.c_id_no = c.c_id_no and s_id='" + session_id + "'";
myResultSet = stmt.executeQuery(mySQL);
if (myResultSet != null) {
while (myResultSet.next()) {
c_id = myResultSet.getString("c_id");
c_id_no = myResultSet.getInt("c_id_no");
c_name = myResultSet.getString("c_name");
%>
<tr>
<td align="center"><%=c_id %></td> <td align="center"><%=c_id_no %></td>
<td align="center"><%=c_name %></td>
<td align="center"><a href="delete.jsp?c_id=<%=c_id %>&c_id_no=<%= c_id_no %>">삭제</a></td>
</tr>
<%
}//while문 끝
}//if문 끝
stmt.close(); myConn.close();
%>
</table></body></html>