我写这段代码并有错误 代码:
<%@ 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>Adib Test</title>
</head>
<body>
<sql:setDataSource var="snapshot"
url="jdbc:mysql://localhost:3306/test"
user="root"
driver="com.mysql.jdbc.*"
password="ad-09139297791+ib"/>
<sql:query dataSource="${snapshot}" var="result">
SELECT * from test
</sql:query>
<table border="1" width="100%">
<tr>
<th>Emp ID</th>
<th>First Name</th>
</tr>
<c:forEach var="row" items="${result.rows}">
<tr>
<td><c:out value="${row.user}"/></td>
<td><c:out value="${row.pass}"/></td>
</tr>
</c:forEach>
</table>
</body>
</html>
</html>
错误
HTTP状态500 - 在第11行处理JSP页面/index.jsp时发生异常
输入例外报告
message在第11行处理JSP页面/index.jsp时发生异常
说明服务器遇到内部错误,导致无法完成此请求。
例外
org.apache.jasper.JasperException:在第11行处理JSP页面/index.jsp时发生异常
8: <title>Adib Test</title>
9: </head>
10: <body>
11: <sql:setDataSource var="snapshot"
12: url="jdbc:mysql://localhost:3306/test"
13: user="root"
14: driver="com.mysql.jdbc.*"
堆栈跟踪:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
根本原因
javax.servlet.ServletException: javax.servlet.jsp.JspTagException: In <driver>, invalid driver class name: "java.lang.ClassNotFoundException: com.mysql.jdbc.*"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:908)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841)
org.apache.jsp.index_jsp._jspService(index_jsp.java:118)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
根本原因
java.lang.ClassNotFoundException: com.mysql.jdbc.*
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
java.lang.Class.forName0(Native Method)
java.a.Class.forName(Class.java:270)
org.apache.taglibs.standard.tag.common.sql.DataSourceWrapper.setDriverClassName(DataSourceWrapper.java:55)
org.apache.taglibs.standard.tag.common.sql.SetDataSourceTagSupport.doStartTag(SetDataSourceTagSupport.java:111)
org.apache.jsp.index_jsp._jspx_meth_sql_005fsetDataSource_005f0(index_jsp.java:144)
org.apache.jsp.index_jsp._jspService(index_jsp.java:91)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
注意Apache Tomcat / 7.0.41日志中提供了根本原因的完整堆栈跟踪。 Apache Tomcat / 7.0.41
请帮助我!!