-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathafindname.jsp
More file actions
36 lines (32 loc) · 1.26 KB
/
Copy pathafindname.jsp
File metadata and controls
36 lines (32 loc) · 1.26 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
35
36
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>
<%
String n = request.getParameter("val");
String branch = request.getParameter("branch");
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 payregister where branch='" + branch + "' and username like '%" + n + "%'");
//ps.setString(1,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:viewAllInfo(this.name)'><B>ID</B></a></td><td><B>Name</B></td><td><B>Salary</B></td></tr>");
while (rs.next()) {
out.print("<tr><td><a href='#' name='" + rs.getString(1)
+ "' onmouseover='javascript:viewAll(this.name)'>" + rs.getString(1) + "</a></td>");
out.print("<td>" + rs.getString(2) + "</td>");
out.print("<td>" + rs.getString(7) + "</td>");
out.print("</tr>");
}
out.print("</table>");
con.close();
} catch (Exception e) {
e.printStackTrace();
}
} //end of if
%>