forked from T1Potato/DBTeamP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevaluate_verify.jsp
66 lines (54 loc) · 1.57 KB
/
evaluate_verify.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 language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<%@ page contentType="text/html; charset=EUC-KR" %>
<%@ page import="java.sql.*" %>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<%
int rate = Integer.parseInt(request.getParameter("rate"));
Connection myConn = null; String result = null;
String dburl = "jdbc:oracle:thin:@localhost:1521:xe";
String user="c##ty"; String passwd="1811184";
String dbdriver = "oracle.jdbc.driver.OracleDriver";
CallableStatement cstmt;
try {
Class.forName(dbdriver);
myConn = DriverManager.getConnection (dburl, user, passwd);
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
boolean stu_mode = true;
String r1="";
String session_id= (String)session.getAttribute("user");
String s_id = (String)session.getAttribute("user");
String c_id = request.getParameter("cid");
cstmt = myConn.prepareCall("{call insertEval(?,?,?,?)}");
cstmt.setString(1, s_id);
cstmt.setString(2, c_id);
cstmt.setInt(3,rate);
cstmt.registerOutParameter(4, java.sql.Types.VARCHAR);
try {
cstmt.execute();
r1 = cstmt.getString(4);
%>
<script>
alert("<%=r1%>");
location.href="evaluate.jsp";
</script>
<%
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
finally {
if (cstmt != null)
try { myConn.commit(); cstmt.close(); myConn.close(); }
catch(SQLException ex) { }
}
%>
</body>
</html>