和以前一样,你们说是什么问题!
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: 6 in the jsp file: /testdb3.jsp
Syntax error on token "import", assert expected
3: <html>
4: <body>
5: <%
6: import java.sql.Connection;
7: import java.sql.DriverManager;
8: import java.sql.PreparedStatement;
9: import java.sql.ResultSet;
An error occurred at line: 6 in the jsp file: /testdb3.jsp
java.sql.Connection cannot be resolved
3: <html>
4: <body>
5: <%
6: import java.sql.Connection;
7: import java.sql.DriverManager;
8: import java.sql.PreparedStatement;
9: import java.sql.ResultSet;
An error occurred at line: 7 in the jsp file: /testdb3.jsp
Syntax error on token "import", assert expected
4: <body>
5: <%
6: import java.sql.Connection;
7: import java.sql.DriverManager;
8: import java.sql.PreparedStatement;
9: import java.sql.ResultSet;
10: import java.sql.SQLException;
An error occurred at line: 7 in the jsp file: /testdb3.jsp
java.sql.DriverManager cannot be resolved
4: <body>
5: <%
6: import java.sql.Connection;
7: import java.sql.DriverManager;
8: import java.sql.PreparedStatement;
9: import java.sql.ResultSet;
10: import java.sql.SQLException;
An error occurred at line: 8 in the jsp file: /testdb3.jsp
Syntax error on token "import", assert expected
5: <%
6: import java.sql.Connection;
7: import java.sql.DriverManager;
8: import java.sql.PreparedStatement;
9: import java.sql.ResultSet;
10: import java.sql.SQLException;
11:
An error occurred at line: 8 in the jsp file: /testdb3.jsp
java.sql.PreparedStatement cannot be resolved
5: <%
6: import java.sql.Connection;
7: import java.sql.DriverManager;
8: import java.sql.PreparedStatement;
9: import java.sql.ResultSet;
10: import java.sql.SQLException;
11:
An error occurred at line: 9 in the jsp file: /testdb3.jsp
Syntax error on token "import", assert expected
6: import java.sql.Connection;
7: import java.sql.DriverManager;
8: import java.sql.PreparedStatement;
9: import java.sql.ResultSet;
10: import java.sql.SQLException;
11:
12: public class DBConnection {
An error occurred at line: 9 in the jsp file: /testdb3.jsp
java.sql.ResultSet cannot be resolved
6: import java.sql.Connection;
7: import java.sql.DriverManager;
8: import java.sql.PreparedStatement;
9: import java.sql.ResultSet;
10: import java.sql.SQLException;
11:
12: public class DBConnection {
An error occurred at line: 10 in the jsp file: /testdb3.jsp
Syntax error on token "import", assert expected
7: import java.sql.DriverManager;
8: import java.sql.PreparedStatement;
9: import java.sql.ResultSet;
10: import java.sql.SQLException;
11:
12: public class DBConnection {
13: private static Connection conn = null;
An error occurred at line: 10 in the jsp file: /testdb3.jsp
java.sql.SQLException cannot be resolved
7: import java.sql.DriverManager;
8: import java.sql.PreparedStatement;
9: import java.sql.ResultSet;
10: import java.sql.SQLException;
11:
12: public class DBConnection {
13: private static Connection conn = null;
An error occurred at line: 12 in the jsp file: /testdb3.jsp
Illegal modifier for the local class DBConnection; only abstract or final is permitted
9: import java.sql.ResultSet;
10: import java.sql.SQLException;
11:
12: public class DBConnection {
13: private static Connection conn = null;
14:
15: static
An error occurred at line: 12 in the jsp file: /testdb3.jsp
Cannot define static initializer in inner type DBConnection
9: import java.sql.ResultSet;
10: import java.sql.SQLException;
11:
12: public class DBConnection {
13: private static Connection conn = null;
14:
15: static
An error occurred at line: 25 in the jsp file: /testdb3.jsp
The method getConnection cannot be declared static; static methods can only be declared in a static or top level type
22: }
23: }
24:
25: public static Connection getConnection()
26: {
27: String url = "jdbc:mysql://localhost:8080/first";
28: String user="root";
An error occurred at line: 40 in the jsp file: /testdb3.jsp
The method close cannot be declared static; static methods can only be declared in a static or top level type
37: }
38:
39:
40: public static void close()
41: {
42: if(conn!=null)
43: {
An error occurred at line: 73 in the jsp file: /testdb3.jsp
The method main cannot be declared static; static methods can only be declared in a static or top level type
70: close();
71: }
72: }
73: public static void main(String[] args) {
74: new DBConnection().printResult("about");
75: //你将这段代码运行看看,是不是有数据输出.
76: //表名,数据库用户以及密码我都按照你的写的,你用改了直接运行看看
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
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.10 logs.

-------哼!谁说不可以-------









