A First JSP Database
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %> <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql_rt" %> <sql:setDataSource var="datasource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/publish" /> <sql:query var="books" dataSource="${datasource}"> SELECT id, title, price FROM book </sql:query> <html> <head> <title>A First JSP Database</title> </head> <body> <table border="1"> <tr> <td>id</td><td>title</td><td>price</td> </tr> <c:forEach items="${books.rows}" var="row"> <tr> <td><c:out value="${row.id}" /></td> <td><c:out value="${row.title}" /></td> <td><c:out value="${row.price}" /></td> </tr> </c:forEach> </table> </body> </html>