Mysql
 sql >> Database >  >> RDS >> Mysql

Nessun dato estratto dal database MySQL durante l'esecuzione della mia pagina JSP

<%@ 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/EMP"
     user="root" password="password"/>

<sql : query dataSource="${snapshot}" var="result">
 SELECT * from Employees;
</sql : query>

<table border="1" width="100%">
<tr>
<th>Emp ID</th>
<th>Age</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
<c:forEach var="row" items="${result.rows}">
<tr>
<td><c:out value="${row.id}"/></td>
<td><c:out value="${row.age}"/></td>
<td><c:out value="${row.first}"/></td>
<td><c:out value="${row.last}"/></td>
</tr>`enter code here`
</c:forEach>
</table>
</body>
</html>