| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1558 人关注过本帖
标题:[求助] jsp + mysql 的问题
取消只看楼主 加入收藏
aneylinwuhui
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-6-5
收藏
 问题点数:0 回复次数:3 
[求助] jsp + mysql 的问题

我的原码是:

<%@ page contentType="text/html; charset=Shift_JIS" %>

<%@ page language="java" %>

<%@ page import="com.mysql.jdbc.Driver" %>

<%@ page import="java.sql.*" %>

<%

//驱动程序名

String driverName="com.mysql.jdbc.Driver";

//数据库用户名

String userName="root";

//密码

String userPasswd="wuhui";

//数据库名

String dbName="hokenn";

//表名

String tableName="wode";


String url="jdbc:mysql://localhost/"+dbName+"?user="+userName+"&password="+userPasswd;

Class.forName("com.mysql.jdbc.Driver").newInstance();

Connection connection=DriverManager.getConnection(url);


Statement Statement=conn.createStatement();

Statement.executeUpdate(\"INSERT into wode(numble,name,xing)\" + \"values(\'numble\',\'name\')\");


out.println(\"记录插入完毕!\");
Statement.close();
conn.close();

%>




可是运行就出现以下错误:

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: 9 in the jsp file: /t.jsp
Generated servlet error:
conn cannot be resolved

An error occurred at line: 9 in the jsp file: /t.jsp
Generated servlet error:
statement cannot be resolved

An error occurred at line: 9 in the jsp file: /t.jsp
Generated servlet error:
Stmt cannot be resolved

An error occurred at line: 9 in the jsp file: /t.jsp
Generated servlet error:
conn cannot be resolved


    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

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

An error occurred at line: 9 in the jsp file: /t.jsp
Generated servlet error:
conn cannot be resolved

An error occurred at line: 9 in the jsp file: /t.jsp
Generated servlet error:
statement cannot be resolved

An error occurred at line: 9 in the jsp file: /t.jsp
Generated servlet error:
Stmt cannot be resolved

An error occurred at line: 9 in the jsp file: /t.jsp
Generated servlet error:
conn cannot be resolved


    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

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


Apache Tomcat/5.5.20


都做了好几天了 还没有弄好 希望有能者能救救我

在线等 谢谢了!

搜索更多相关主题的帖子: jsp mysql 
2007-06-07 11:01
aneylinwuhui
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-6-5
收藏
得分:0 
能不能在说的清楚一点啊!我是刚学的

应该怎么改才好啊!
2007-06-07 11:15
aneylinwuhui
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-6-5
收藏
得分:0 
谢谢了!我在去试试!
2007-06-07 11:18
aneylinwuhui
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-6-5
收藏
得分:0 
如何给我的数据库连接做异常处理

能不能给个例子 给我看看啊!
真是不好意思啊!我是刚学的!

先感谢了!
2007-06-07 11:45
快速回复:[求助] jsp + mysql 的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024270 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved