Guest User

Untitled

a guest
Jan 25th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  2. <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
  3. <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
  4. <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
  5.  
  6. <html>
  7. <head>
  8. <title>JSTL sql:query Tag</title>
  9. </head>
  10. <body>
  11.  
  12. <sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver"
  13. url="jdbc:mysql://localhost:3306/mydb"
  14. user="root" password="root"/>
  15.  
  16. <sql:query dataSource="${snapshot}" var="result">
  17. SELECT * from dateinfo;
  18. </sql:query>
  19.  
  20. <table border="1" width="100%">
  21. <tr>
  22. <th>Emp ID</th>
  23. <th>First Name</th>
  24. <th>Last Name</th>
  25. <th>Age</th>
  26. </tr>
  27. <c:forEach var="row" items="${result.rows}">
  28. <tr>
  29. <td><c:out value="${row.id}"/></td>
  30. <td><c:out value="${row.first}"/></td>
  31. <td><c:out value="${row.last}"/></td>
  32. <td><c:out value="${row.age}"/></td>
  33. </tr>
  34. </c:forEach>
  35. </table>
  36.  
  37. </body>
  38. </html>
  39.  
  40. javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get
  41. connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/mydb"
Add Comment
Please, Sign In to add comment