-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgename.jsp
More file actions
34 lines (29 loc) · 1.14 KB
/
Copy pathgename.jsp
File metadata and controls
34 lines (29 loc) · 1.14 KB
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
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>
<%
String n = request.getParameter("val");
if (n.length() > 0) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system",
"shonu123");
PreparedStatement ps = con.prepareStatement("select * from student where name like '" + n + "%'");
out.print("<br>");
ResultSet rs = ps.executeQuery();
out.print("<table border='5' cellspacing=5 cellpadding=2 id='myTable'>");
out.print(
"<tr><td><a href='#' name='ID' onmouseover='javascript:getGenInfo(this.name)'><B>ID</B></a></td><td><B>Name</B></td><td><B>Mobile</B></td></tr>");
while (rs.next()) {
out.print("<tr><td><a href='#' name='" + rs.getString(1)
+ "' onmouseover='javascript:sendGenInfo(this.name)'>" + rs.getString(1) + "</a></td>");
out.print("<td>" + rs.getString(2) + "</td>");
out.print("<td>" + rs.getString(4) + "</td>");
out.print("</tr>");
}
out.print("</table>");
con.close();
} catch (Exception e) {
e.printStackTrace();
}
}
%>