日期:2014-05-18  浏览次数:20687 次

各位高手,帮忙看一下,HTTP Status 500 - 愁死了
HTTP Status 500 - 

--------------------------------------------

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 10 in the jsp file: /corrision/conn/conn.jsp
com.mysql.jdbc.Driver cannot be resolved to a type
7: Statement stmt;
8: ResultSet rs;
9: Class.forName("com.mysql.jdbc.Driver");
10: DriverManager.registerDriver(new com.mysql.jdbc.Driver());
11: String dbUrl="jdbc:mysql://localhost:3306/OA?useUnicode=true&characterEncoding=GBK";
12: String dbUser="root";
13: String dbPwd="123456";


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs.


--------------------------------------------

Apache Tomcat/6.0.16
这是conn.jsp
<%@ page contentType="text/html;charset=GBK" %>
<link rel="stylesheet" href="../conn/laba.css" type="text/css">
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%Connection con;
Statement stmt;
ResultSet rs;
Class.forName("com.mysql.jdbc.Driver");
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
String dbUrl="jdbc:mysql://localhost:3306/OA?useUnicode=true&characterEncoding=GBK";
String dbUser="root";
String dbPwd="123456";
con=java.sql.DriverManager.getConnection(dbUrl,dbUser,dbPwd);
stmt=con.createStatement();
%>



各位高手帮忙看一下,愁死我了,弄了一个星期了,还是没弄明白

------解决方案--------------------
<%@ page contentType="text/html;charset=GBK" %> 
<link rel="stylesheet" href="../conn/laba.css" type="text/css"> 
<%@ page import="java.io.*" %> 
<%@ page import="java.util.*" %> 
<%@ page import="java.sql.*" %> 
<%Connection con; 
Statement stmt; 
ResultSet rs; 
Class.forName("com.mysql.jdbc.Driver"); 
con=java.sql.DriverManager.getConnection(dbUrl,dbUser,dbPwd);
String dbUrl="jdbc:mysql://localhost:3306/OA?useUnicode=true&characterEncoding=GBK"; 
String dbUser="root"; 
String dbPwd=&qu