JSP 页面报错HTTP STATUS 500(测试页通过)【小弟分不多,见谅】

richardlaurent 2009-12-27 02:36:47
我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: File "/utility/scriptFunction.jsp" not found
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


root cause

javax.servlet.ServletException: File "/utility/scriptFunction.jsp" not found
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:965)
org.apache.jsp.index_jsp._jspService(index_jsp.java:52)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


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


--------------------------------------------------------------------------------

Apache Tomcat/5.5.27

我的/utility/scriptFunction.jsp明明在啊,为什么找不到呢。。。
<script type="text/javascript">
<!--
var time = 3000;
var numofitems = 7;

//menu constructor
function menu(allitems,thisitem,startstate){
callname= "gl"+thisitem;
divname="subglobal"+thisitem;
this.numberofmenuitems = 7;
this.caller = document.getElementById(callname);
this.thediv = document.getElementById(divname);
this.thediv.style.visibility = startstate;
}

//menu methods
function ehandler(event,theobj){
for (var i=1; i<= theobj.numberofmenuitems; i++){
var shutdiv =eval( "menuitem"+i+".thediv");
shutdiv.style.visibility="hidden";
}
theobj.thediv.style.visibility="visible";
}

function closesubnav(event){
if ((event.clientY <48)||(event.clientY > 107)){
for (var i=1; i<= numofitems; i++){
var shutdiv =eval('menuitem'+i+'.thediv');
shutdiv.style.visibility='hidden';
}
}
}
// -->
</script>

再附上我的DBClass

/**
* 该类为网上书店操作数据库的公用类
* 用于数据库连接、查询和更新等操作
*/
package bean;

import java.io.*;
import java.util.*;
import java.sql.*;

public class DBClass
{
private String driver;
private String url;
private String username;
private String password;
private Connection connection;
private Statement statement;
private String message="";

public DBClass(){
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver";
url="jdbc:sqlserver://localhost:1433; DatabaseName=bookshop"; //连接服务器和数据库sample
username="sa";
password="";
connection=null;
statement=null;
message="";


}

public DBClass(String driver,String url,String username,String password){
this.driver=driver;
this.url=url;
this.username=username;
this.password=password;
this.connection=null;
this.statement=null;
this.message="";
}

public String getDriver(){
return driver;
}

public void setDriver(String driver){
this.driver=driver;
}

public String getUrl(){
return url;
}

public void setUrl(String url){
this.url=url;
}

public String getUsername(){
return username;
}

public void setUsername(String username){
this.username=username;
}

public String getPassword(){
return password;
}

public void setPassword(String password){
this.password=password;
}

public Connection getConnection(){
return connection;
}

public void setConnection(Connection connection){
this.connection=connection;
}

public Statement getStatement(){
return statement;
}

public void setStatement(Statement statement){
this.statement=statement;
}


public String getMessage(){
return message;
}

public void setMessage(String message){
this.message=message;
}

/* 连接数据库 */
public void connect(){
try{
Class.forName(driver);
connection=DriverManager.getConnection(url,username,password);
statement=connection.createStatement();
}catch(ClassNotFoundException cnfe){
message="connection:"+cnfe;
}catch(SQLException sqle){
message="executeQuery:"+sqle;
}
}

/* 执行SQL查询并返回结果 */
public ResultSet executeQuery(String query){
ResultSet resultset=null;
try{
resultset=statement.executeQuery(query);
}catch(SQLException sqle){
message="executeQuery:"+sqle;
}
return resultset;
}

/* 执行数据库更新操作 */
public void executeUpdate(String command){
try{

statement.executeUpdate(command);
}catch(SQLException sqle){
message="executeUpdate:"+sqle;
}
}

/* 关闭数据库连接 */
public void closeConnection(){
try{
connection.close();
}catch(SQLException sqle){
message="closeConnection:"+sqle;
}
}
}
...全文
116 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
lzh_me 2009-12-27
  • 打赏
  • 举报
回复
你需要把引用的代码贴一下,

你也可以直接去查看编译后的jsp页面的.java根据行数找错误
(org.apache.jsp.index_jsp._jspService(index_jsp.java:52) )
richardlaurent 2009-12-27
  • 打赏
  • 举报
回复
[Quote=引用 15 楼 tzsword 的回复:]
引用 12 楼 richardlaurent 的回复:
引用 6 楼 tzsword 的回复:
引用 3 楼 lvbang_lzt 的回复:
500是内部错误,如果找不到页就会是404了,看看是不是哪写错了

  org.apache.jsp.index_jsp._jspService(index_jsp.java:52)
 index.jsp的52行错误引发的。。。
 

index.jsp的52行是 <jsp:include page="/utility/menu.jsp" />
我的utillity是在根目录下的,和webroot同级

  你的 index界面是在什么位置是在utility下吗?
[/Quote]
我放在webroot下的
richardlaurent 2009-12-27
  • 打赏
  • 举报
回复
呃,不能追加了,大家先帮我吧,到时我再开个帖给分吧
richardlaurent 2009-12-27
  • 打赏
  • 举报
回复
谢谢cqhweb帮我把代码整理了下,现追加100分,不知道有没有
TzSword 2009-12-27
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 richardlaurent 的回复:]
引用 6 楼 tzsword 的回复:
引用 3 楼 lvbang_lzt 的回复:
500是内部错误,如果找不到页就会是404了,看看是不是哪写错了

  org.apache.jsp.index_jsp._jspService(index_jsp.java:52)
 index.jsp的52行错误引发的。。。
 

index.jsp的52行是 <jsp:include page="/utility/menu.jsp" />
我的utillity是在根目录下的,和webroot同级
[/Quote]
你的 index界面是在什么位置是在utility下吗?
zys2419740 2009-12-27
  • 打赏
  • 举报
回复
或者看看你的页面名字和你写的一样不?
zys2419740 2009-12-27
  • 打赏
  • 举报
回复
页面解析错误,看看struts。xml是否配置错了
richardlaurent 2009-12-27
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 tzsword 的回复:]
引用 3 楼 lvbang_lzt 的回复:
500是内部错误,如果找不到页就会是404了,看看是不是哪写错了

  org.apache.jsp.index_jsp._jspService(index_jsp.java:52)
 index.jsp的52行错误引发的。。。
 
[/Quote]
index.jsp的52行是<jsp:include page="/utility/menu.jsp" />
我的utillity是在根目录下的,和webroot同级
TzSword 2009-12-27
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 tzsword 的回复:]
引用 3 楼 lvbang_lzt 的回复:
500是内部错误,如果找不到页就会是404了,看看是不是哪写错了

  org.apache.jsp.index_jsp._jspService(index_jsp.java:52)
 index.jsp的52行错误引发的。。。
 
[/Quote]
终于看到了。。。
你在上面这一行写了include吧 include的路径为相对路径。。
有时间你的导入文件会报错的
<%@ page language=”java” contentType=”text/html;charset=gb2312”%>
适合导入静态的页面
richardlaurent 2009-12-27
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 cqhweb 的回复:]
看一下路径是否正确。。
[/Quote]

路径是正确的吧,应该没错
luffyke 2009-12-27
  • 打赏
  • 举报
回复
重启小猫!看看那个JSP有没有导入,再自己检查一下是不是页面有错误
cqhweb 2009-12-27
  • 打赏
  • 举报
回复
看一下路径是否正确。。
cqhweb 2009-12-27
  • 打赏
  • 举报
回复
<
script type="text/javascript"> 
<!--
var time = 3000;
var numofitems = 7;

//menu constructor
function menu(allitems,thisitem,startstate){
callname= "gl"+thisitem;
divname="subglobal"+thisitem;
this.numberofmenuitems = 7;
this.caller = document.getElementById(callname);
this.thediv = document.getElementById(divname);
this.thediv.style.visibility = startstate;
}

//menu methods
function ehandler(event,theobj){
for (var i=1; i <= theobj.numberofmenuitems; i++){
var shutdiv =eval( "menuitem"+i+".thediv");
shutdiv.style.visibility="hidden";
}
theobj.thediv.style.visibility="visible";
}

function closesubnav(event){
if ((event.clientY <48)||(event.clientY > 107)){
for (var i=1; i <= numofitems; i++){
var shutdiv =eval('menuitem'+i+'.thediv');
shutdiv.style.visibility='hidden';
}
}
}
// -->
</script>

再附上我的DBClass

/**
* 该类为网上书店操作数据库的公用类
* 用于数据库连接、查询和更新等操作
*/
package bean;

import java.io.*;
import java.util.*;
import java.sql.*;

public class DBClass
{
private String driver;
private String url;
private String username;
private String password;
private Connection connection;
private Statement statement;
private String message="";

public DBClass(){
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver";
url="jdbc:sqlserver://localhost:1433; DatabaseName=bookshop"; //连接服务器和数据库sample
username="sa";
password="";
connection=null;
statement=null;
message="";


}

public DBClass(String driver,String url,String username,String password){
this.driver=driver;
this.url=url;
this.username=username;
this.password=password;
this.connection=null;
this.statement=null;
this.message="";
}

public String getDriver(){
return driver;
}

public void setDriver(String driver){
this.driver=driver;
}

public String getUrl(){
return url;
}

public void setUrl(String url){
this.url=url;
}

public String getUsername(){
return username;
}

public void setUsername(String username){
this.username=username;
}

public String getPassword(){
return password;
}

public void setPassword(String password){
this.password=password;
}

public Connection getConnection(){
return connection;
}

public void setConnection(Connection connection){
this.connection=connection;
}

public Statement getStatement(){
return statement;
}

public void setStatement(Statement statement){
this.statement=statement;
}


public String getMessage(){
return message;
}

public void setMessage(String message){
this.message=message;
}

/* 连接数据库 */
public void connect(){
try{
Class.forName(driver);
connection=DriverManager.getConnection(url,username,password);
statement=connection.createStatement();
}catch(ClassNotFoundException cnfe){
message="connection:"+cnfe;
}catch(SQLException sqle){
message="executeQuery:"+sqle;
}
}

/* 执行SQL查询并返回结果 */
public ResultSet executeQuery(String query){
ResultSet resultset=null;
try{
resultset=statement.executeQuery(query);
}catch(SQLException sqle){
message="executeQuery:"+sqle;
}
return resultset;
}

/* 执行数据库更新操作 */
public void executeUpdate(String command){
try{

statement.executeUpdate(command);
}catch(SQLException sqle){
message="executeUpdate:"+sqle;
}
}

/* 关闭数据库连接 */
public void closeConnection(){
try{
connection.close();
}catch(SQLException sqle){
message="closeConnection:"+sqle;
}
}
}
TzSword 2009-12-27
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 lvbang_lzt 的回复:]
500是内部错误,如果找不到页就会是404了,看看是不是哪写错了
[/Quote]
org.apache.jsp.index_jsp._jspService(index_jsp.java:52)
index.jsp的52行错误引发的。。。
richardlaurent 2009-12-27
  • 打赏
  • 举报
回复
谢谢楼上的。贴代码我以后会注意的。先给点分吧
xinwugang 2009-12-27
  • 打赏
  • 举报
回复
500错是语法错误,不是找不到页面的错啊,看你的那个页面,或是看你的后台代码
lzh_me 2009-12-27
  • 打赏
  • 举报
回复
500是内部错误,如果找不到页就会是404了,看看是不是哪写错了
xiezhifu 2009-12-27
  • 打赏
  • 举报
回复
提醒楼主和新手们一句,如果是贴代码一定要记得使用代码插件,让热心的大虾看代码看得舒服一点
xiezhifu 2009-12-27
  • 打赏
  • 举报
回复
启动服务器直接运行你的/utility/scriptFunction.jsp文件,如果能运行则可能是你调用的文件路径有问题,如果不能运行,请检查你的scriptFunction.jsp代码是否哪里出错,服务器不能编译识别。这种问题我也遇见过,不过自己没有总结过,那时都是这样检查的

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧