JSP调试时出现下列代码是什么原因导致 急急急急急急

aty888 2009-03-09 05:00:16
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: /02/index.jsp(2,0) The value for the useBean class attribute com.ConnDB is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1200)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1160)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
org.apache.jasper.compiler.Generator.generate(Generator.java:3372)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
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
...全文
111 6 点赞 打赏 收藏 举报
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
aty888 2009-03-10
问题解决了
但是有一新的问题
连上数据库但是不显示内容

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" %>
<jsp:useBean id="conn" scope="page" class="com.ConnDB"/>
<%
String sql="select ISBN,BookName,publisher,newbook,commend from tb_bookinfo";
ResultSet rs=conn.executeQuery(sql);
%>
<html>
<head>
<title>打开新窗口显示详细信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="CSS/style.css" rel="stylesheet">
<script src="JS/check.jsp"></script>
</head>

<body>
<table width="777" height="440" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="440" valign="top">
<jsp:include page="Top.jsp"/>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableBorder_LTR">
<tr>
<td height="30" align="center" bgcolor="#eeeeee">≡≡≡ <span class="word_grey"><a href="#">添加菜肴信息</a></span> ≡≡≡</td>
</tr>
</table>
<table width="100%" height="396" border="0" cellpadding="0" cellspacing="0" class="tableBorder_LBR">
<tr>
<td width="26%" height="395" valign="top"><table width="100%" border="0" cellspacing="-2" cellpadding="-2">
<tr>
<td width="55%" height="82" align="center" class="word_grey"> <img src="Images/reg.gif" width="84" height="54"></td>
<td width="45%" align="left" class="word_grey">菜肴管理</td>
</tr>
<tr>
<td height="112" colspan="2" valign="top" class="word_grey"><ul>
<li> 添加菜肴信息:单击“添加菜肴信息”超链接可以进行菜肴信息的添加。<br>
<br>
</li>
<li>修改菜肴信息:单击每条菜肴信息后面的“修改”按钮可以修改菜肴信息。<br>
<br>
</li>
<li>推荐菜肴:如果想推荐菜肴,可以点击指定图书后的“修改”按钮。<br>
<br>
</li>
<li>是否新菜:如果想将菜肴信息发布到新菜肴架中,可以点击指定菜肴后的“修改”按钮。</li>
</ul></td>
</tr>
<tr align="center">
<td colspan="2" valign="middle" class="word_grey"></td>
</tr>
</table></td>
<td width="5" valign="top" background="Images/Cen_separate.gif"></td>
<td width="73%" valign="top"><table width="100%" height="14" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="13" align="center"> </td>
</tr>
</table>
<table width="100%" height="48" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#CCCCCC" bordercolorlight="#FFFFFF">
<tr>
<td width="18%" height="27" align="center">菜号</td>
<td width="36%" align="center">菜名</td>
<td width="20%" align="center">价格</td>
<td width="8%" align="center">新菜否</td>
<td width="8%" align="center">推荐否</td>
<td width="5%" align="center">修改</td>
</tr>
<%
try{
String ISBN="";
String BookName="";
String publisher="";
String newbook="";
String commend="";
while(rs.next()){
ISBN=rs.getString("ISBN");
BookName=rs.getString("BookName");
publisher=rs.getString("publisher");
newbook=rs.getInt("newbook")==0 ? "否":"是";
commend=rs.getInt("commend")==0 ? "否":"是";
%>

<tr style="padding:5px;">
<td height="24" align="center"><%=ISBN%></td>
<td align="center"><%=BookName%></td>
<td align="center"><%=publisher%></td>
<td align="center"><%=newbook%></td>
<td align="center"><%=commend%></td>
<td align="center"><img src="Images/modify.gif" width="15" height="15"></td>
</tr>
<%
}
}catch(Exception e){}
%>
</table>
</td>
</tr>
</table>
<jsp:include page="copyright.jsp"/>
</td>
</tr>
</table>
</body>
</html>


Index代码



连接Bean代码package com;

import java.sql.*;

/**
* 文件名:ConnDB
* 描述:操作数据库
*
*
*/
public class ConnDB {
Connection conn = null;

Statement stmt = null;

ResultSet rs = null;

public ConnDB() {
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
} catch (java.lang.ClassNotFoundException e) {
System.err.println(e.getMessage());
}
}

/**
* 功能描述: 执行查询操作
* 参数: String
* 返回值: ResultSet
*/
public ResultSet executeQuery(String sql) {
try {
conn = DriverManager
.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=db_JSDQ11;user=sa;password=");
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
rs = stmt.executeQuery(sql);
} catch (SQLException ex) {
System.err.println(ex.getMessage());
}
return rs;
}

/**
* 功能描述: 执行更新操作
* 参数: String
* 返回值: int
*/
public int executeUpdate(String sql) {
int result = 0;
try {
conn = DriverManager
.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=db_JSDQ11;user=sa;password=");
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
result = stmt.executeUpdate(sql);
} catch (SQLException ex) {
result = 0;
}
return result;
}

/**
* 功能描述: 关闭数据库连接
* 参数: 无
* 返回值: void
*/
public void close() {
try {
if (rs != null)
rs.close();
} catch (Exception e) {
e.printStackTrace(System.err);
}
try {
if (stmt != null)
stmt.close();
} catch (Exception e) {
e.printStackTrace(System.err);
}
try {
if (conn != null) {
conn.close();
}
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
}


  • 打赏
  • 举报
回复
flylovejings 2009-03-09
The value for the useBean class attribute com.ConnDB is invalid. ???

connection 有问题!!!

这是最简单的500

把代码异常处帖出来!
  • 打赏
  • 举报
回复
canyingwushang 2009-03-09
500錯誤就是你写的代码有问题了,你可以到Tomcat的Work目录下找到JSP产生的Java文件看看生成的代码是不是你所期望的那样~~~
  • 打赏
  • 举报
回复
niuxinlong 2009-03-09
index.jsp中com.ConnDB这个东西不能识别
  • 打赏
  • 举报
回复
aty888 2009-03-09
自己在顶下
  • 打赏
  • 举报
回复
aty888 2009-03-09
高手在那里???
  • 打赏
  • 举报
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2009-03-09 05:00
社区公告
暂无公告