jsp连接数据库出的问题
我连接的是sqlserver2000.我的程序中数据库连接的代码如下:
String MapID = request.getParameter( "MapID ");
String MapFileName= " ";
int NumOfWarehouses=0;
System.out.println(MapID);
DBConnect.dbconnect = new DBConnect();
boolean isconnect = dbconnect.connect();
出错的提示如下 :
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
Generated servlet error:
F:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\wmsgis\wmsgis\mapinfo_jsp.java:7: 软件包 DB 不存在
import DB.*;
^
An error occurred at line: 23 in the jsp file: /wmsgis/wmsgis/mapinfo.jsp
Generated servlet error:
F:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\wmsgis\wmsgis\mapinfo_jsp.java:71: 找不到符号
符号: 类 DBConnect
位置: 类 org.apache.jsp.wmsgis.wmsgis.mapinfo_jsp
DBConnect dbconnect = new DBConnect();
^
An error occurred at line: 23 in the jsp file: /wmsgis/wmsgis/mapinfo.jsp
Generated servlet error:
F:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\wmsgis\wmsgis\mapinfo_jsp.java:71: 找不到符号
符号: 类 DBConnect
位置: 类 org.apache.jsp.wmsgis.wmsgis.mapinfo_jsp
DBConnect dbconnect = new DBConnect();
^
3 错误
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
[解决办法]
DB这个包不存在.可能是你引包的时候包名出现错误.DBConnect该类没有引进来.你好好的检查DBConnect存在的位置.重新引入DBConnect试试看.
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html
我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.myexception.cn/j2ee/2308.html