| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 727 人关注过本帖
标题:为什么总是HTTP Status 500?
取消只看楼主 加入收藏
lovecrissy
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-3-29
收藏
 问题点数:0 回复次数:0 
为什么总是HTTP Status 500?

我是JSP初学者,在做设计的时候遇到下面问题:

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
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
	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

java.lang.NullPointerException
	org.apache.jsp.jsp.default_jsp._jspService(org.apache.jsp.jsp.default_jsp:102)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
	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.12 logs.

default.jsp页面的源代码:
<%@page contentType="text/html;charset=GBK" %>

<%@page import="load.*,java.sql.*" %>
<jsp:useBean id="conn" scope="page" class="load.conn"/>
<jsp:useBean id="rstogbk" scope="page" class="load.RsToGbk"/>
<%! ResultSet rs=null; %>
<html>
<head>
<title>我的软件仓库</title>
<Link rel="stylesheet"type="text/css" href="style.css">
</head>
<body TEXT="#000000"BGCOLOR="#FFFFFF"BACKGROUND="b01.jpg">
<Center>
<%@include file="title.htm" %>
<h2>我的软件仓库-软件排行榜</h2>
</Center>
<%
String sql="Select Top 10 *From download Order By hits DESC";
rs=conn.executeQuery(sql);
while(rs.next()){
out.println(rstogbk.RsToGbook(rs));
}
%>
</body>
</html>
我连接数据库的JavaBean的代码:
package load;
import java.sql.*;
public class conn{
String sDBDriver="sun.jdbc.odbc.jdbcOdbcDriver";
String sConnStr="jdbc:odbc:download";
Connection connect=null;
ResultSet rs=null;

public conn(){
try{
Class.forName(sDBDriver);
} catch(java.lang.ClassNotFoundException e){
System.err.println(e.getMessage());
}
}
public ResultSet executeQuery(String sql){
try{
connect=DriverManager.getConnection(sConnStr);
Statement stmt=connect.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
rs=stmt.executeQuery(sql);
}
catch(SQLException ex){
System.err.println(ex.getMessage());
}
return rs;
}
public int executeUpdate(String sql){
int result=0;
try{
connect=DriverManager.getConnection(sConnStr);
Statement stmt=connect.createStatement();
result=stmt.executeUpdate(sql);
}
catch(SQLException ex){
System.err.println(ex.getMessage());
}
return result;
}
}

搜索更多相关主题的帖子: Status HTTP 
2006-03-29 13:33
快速回复:为什么总是HTTP Status 500?
数据加载中...
 
   



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

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