<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<html>
<head>
<title>JSTL sql:query Tag</title>
</head>
<body>
<sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/mydb"
user="root" password="root"/>
<sql:query dataSource="${snapshot}" var="result">
SELECT * from dateinfo;
</sql:query>
<table border="1" width="100%">
<tr>
<th>Emp ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Age</th>
</tr>
<c:forEach var="row" items="${result.rows}">
<tr>
<td><c:out value="${row.id}"/></td>
<td><c:out value="${row.first}"/></td>
<td><c:out value="${row.last}"/></td>
<td><c:out value="${row.age}"/></td>
</tr>
</c:forEach>
</table>
</body>
</html>
当我执行此程序时发生异常....
javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get
connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/mydb"
即使我可以在我的netbeans中包含mysqlconnector.jar,jstl.jar and standard.jar
文件
项目还加上所有的解放,请帮帮我......
任何帮助都将受到高度赞赏