-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquery1.jsp
41 lines (31 loc) · 944 Bytes
/
query1.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
<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<html>
<head>
<title>Names of employees at the Phoenix Metro Branch</title>
</head>
<body>
<sql:setDataSource var="snapshot" driver="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@aloe.cs.arizona.edu:1521:oracle"
user="tkoch" password="a6743"/>
<sql:query dataSource="${snapshot}" var="result">
select unique firstname, lastname
from mattseall.employee
where branch_id='Phoenix Metro Branch'
</sql:query>
<table border="1" width="100%">
<tr>
<th>First Name</th>
<th>Last Name</th>
</tr>
<c:forEach var="row" items="${result.rows}">
<tr>
<td><c:out value="${row.firstname}"/></td>
<td><c:out value="${row.lastname}"/></td>
</tr>
</c:forEach>
</table>
</body>
</html>