Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ 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>SELECT Operation</title>
- </head>
- <body>
- <sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver"
- url="jdbc:mysql://localhost/betatest"
- user="root" password="root"/>
- <sql:query dataSource="${snapshot}" var="result">
- SELECT * from table1;
- </sql:query>
- <table border="1" width="100%">
- <tr>
- <th>Student ID</th>
- <th>Course</th>
- </tr>
- <c:forEach var="row" items="${result.rows}">
- <tr>
- <td><c:out value="${row.student_id}"/></td>
- <td><c:out value="${row.course}"/></td>
- </tr>
- </c:forEach>
- </table>
- </body>
- </html>
Add Comment
Please, Sign In to add comment