<%@taglib prefix=\"c\" uri=\"http://java.sun.com/jsp/jstl/core\" %>
<%@taglib prefix=\"sql\" uri=\"http://java.sun.com/jstl/sql\" %>
SELECT * FROM provider;
Replace your code and import sql package
or import sql package and Remove ; from your select statement
My advice would be to forget about the <sql>
tags completely, and to make all your database operations in plain Java (in a servlet or action of your preferred MVC framework). This servlet would build a list of bean instances, ready to be displayed by your JSP. Use RequestDispatcher
to dispatch the request to the JSP from the servlet.
Even the official Java EE tutorial says:
The JSTL SQL tags for accessing databases listed in Table 7-7 are designed for quick prototyping and simple applications. For production applications, database operations are normally encapsulated in JavaBeans components.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<sql:setDataSource var="dataSource" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/cloud" user="root" password="root"
scope="session" />
<sql:query var="qryProvider" dataSource="${dataSource}">
SELECT * FROM provider;
</sql:query>
<table>
<c:forEach var="row" items="${qryProvider.rows}">
<tr>
<td>${row.display_name}</td>
</tr>
</c:forEach>
</table>