Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <%@ 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>JSTL sql:setDataSource Tag</title>
- </head>
- <body>
- <sql:setDataSource var = "snapshot" driver = "oracle.jdbc.driver.OracleDriver"
- url = "jdbc:oracle:thin:@localhost:1521/XE"
- user = "hr" password = "hr"/>
- <sql:query dataSource = "${snapshot}" var = "result">
- SELECT* from Departments
- </sql:query>
- <table border=5>
- <tr>
- <th>DeptNO</th>
- <th>DName</th>
- <th>Location</th>
- </tr>
- <c:forEach var="row" items="${result.rows}">
- <tr>
- <td><c:out value="${row.department_id}"/></td>
- <td><c:out value="${row.department_name}"/></td>
- <td><c:out value="${row.location_id}"/></td>
- </tr>
- </c:forEach>
- </table>
- </body>
- </html>
Add Comment
Please, Sign In to add comment