我的网上购书系统做的差不多了,但是在编译时遇到了问题好象读javabean文件BookInf.class时有错误,难道是BookInf.class编译后有错误,还是放的文件路径有问题,我的bean文件放在ROOT/bookshop/WEB-INF/classes/bean/BookInf.class,运行index.jsp出现下面的提示:HTTP Status 500 - --------------------------------------------------------------------------------type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Unable to compile class for JSPGenerated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:7: package bean does not exist
import bean.BookInf;
^
An error occurred at line: 67 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:130: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index);
^
An error occurred at line: 67 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:130: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index);
^
An error occurred at line: 87 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:172: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+1);
^
An error occurred at line: 87 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:172: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+1);
^
An error occurred at line: 116 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:223: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+2);
^
An error occurred at line: 116 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:223: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+2);
^
An error occurred at line: 135 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:264: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+3);
^
An error occurred at line: 135 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:264: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+3);
^
An error occurred at line: 164 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:315: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+4);
^
An error occurred at line: 164 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:315: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+4);
^
An error occurred at line: 185 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:358: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+5);
^
An error occurred at line: 185 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:358: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+5);
^
13 errors 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)
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:7: package bean does not exist
import bean.BookInf;
^
An error occurred at line: 67 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:130: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index);
^
An error occurred at line: 67 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:130: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index);
^
An error occurred at line: 87 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:172: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+1);
^
An error occurred at line: 87 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:172: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+1);
^
An error occurred at line: 116 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:223: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+2);
^
An error occurred at line: 116 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:223: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+2);
^
An error occurred at line: 135 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:264: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+3);
^
An error occurred at line: 135 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:264: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+3);
^
An error occurred at line: 164 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:315: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+4);
^
An error occurred at line: 164 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:315: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+4);
^
An error occurred at line: 185 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:358: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+5);
^
An error occurred at line: 185 in the jsp file: /bookshop/index.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\bookshop\index_jsp.java:358: cannot resolve symbol
symbol : class BookInf
location: class org.apache.jsp.bookshop.index_jsp
BookInf book= (BookInf)booklist.elementAt(index+5);
^
13 errors 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)
却写的是,import bean.bookinf,应该是import classes.bean.bookinf
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.util.*,classes.bean.BookInf" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>book shop online</title>
<link rel="stylesheet" href="source/bookshop.css" type="text/css">
<jsp:include page="/utility/scriptFunction.jsp" />
</head>
<% request.setCharacterEncoding("gb2312");
response.setContentType("text/html; charset=gb2312");
if(session.getAttribute("booklist")==null){
response.sendRedirect("/bookshop/classes/ShowBook");
} else {
Vector booklist=(Vector)session.getAttribute("booklist");
String pg;
if(request.getParameter("pg")==null){
pg="1";
}else{
pg=request.getParameter("pg");
}
int pgSum=(int)(booklist.size()+5)/6;
int index=(Integer.parseInt(pg)-1)*6;
%>
<body onmousemove="closesubnav(event);">
<div id="masthead">
<jsp:include page="/utility/siteName.jsp" />
<jsp:include page="/utility/navigation.jsp" />
</div>
<div id="pagecell1">
<table width="100%" border="0">
<tr>
<% String requestURL= request.getRequestURI();
String param=request.getQueryString();
String hidAddr="/bookshop/MenuHidden?jspURL=" + requestURL +"¶m="+ param ;
String showAddr="/bookshop/MenuShow?jspURL=" + requestURL +"¶m="+ param ; %>
<td width="211"><a href=<%= hidAddr %> align="left">隐藏</a> / <a href=<%= showAddr %>>显示</a> </td>
<td width="516"><div align="right"><a href="/bookshop/userLogin.jsp"align="right">登陆</a> | <a href="/bookshop/userRegister.jsp">新用户注册</a> | <a href="/bookshop/adminLogin.jsp">管理员入口</a></div></td>
</tr>
</table>
</div>
<table width="100%" border="0">
<tr valign="top">
<% if(session.getAttribute("hidden")==null){ %>
<jsp:include page="/utility/menu.jsp" />
<% } %> <td width="81%" >
<div class="book">
<table width="100%" cellpadding="0" cellspacing="0" summary="">
<tr valign="top">
<td width="5%" > <p>
</p></td>
<% if(index+1<=booklist.size()){
BookInf book= (BookInf)booklist.elementAt(index);
String imgURL="source/"+book.getId()+".JPG";
String commentURL="/bookshop/bookComment.jsp?bookId="+book.getId();
String cartURL="/bookshop/addCart.jsp?bookId="+book.getId();
%>
<td width="23%" ><a href="#" onClick="window.open('<%= commentURL %>','s','width=850,height=600,scrollbars=yes,resizeable=yes,ststus=yes');"><img src=<%= imgURL %> width="135" height="200" border="0" ></a></td>
<td width="22%" ><p class="bookInfo">书名:<%= book.getName() %></p>
<p class="bookInfo">作者:<%= book.getAuthor() %></p>
<p class="bookInfo">出版社:<%= book.getPublisher() %></p>
<p class="bookInfo">类别:<%= book.getType() %></p>
<p class="bookInfo">单价:¥<%= book.getPrice() %></p>
<p class="bookInfo"><a href="#" onClick="window.open('<%= cartURL %>','s','width=300,height=300,scrollbars=yes,resizeable=yes,ststus=yes');"><img src="source/cart.gif" width="130" height="25" border="0"></a></p></td>
<% } else { %>
<td width="23%" height="200"> </td>
<td width="22%" height="200"> </td>
<% } %>
<td width="5%" > </td>
<% if(index+2<=booklist.size()){
BookInf book= (BookInf)booklist.elementAt(index+1);
String imgURL="source/"+book.getId()+".JPG";
String commentURL="/bookshop/bookComment.jsp?bookId="+book.getId();
String cartURL="/bookshop/addCart.jsp?bookId="+book.getId();
%>
<td width="23%" ><a href="#" onClick="window.open('<%= commentURL %>','s','width=850,height=600,scrollbars=yes,resizeable=yes,ststus=yes');"><img src=<%= imgURL %> width="135" height="200" border="0" ></a></td>
<td width="22%" ><p class="bookInfo">书名:<%= book.getName() %></p>
<p class="bookInfo">作者:<%= book.getAuthor() %></p>
<p class="bookInfo">出版社:<%= book.getPublisher() %></p>
<p class="bookInfo">类别:<%= book.getType() %></p>
<p class="bookInfo">单价:¥<%= book.getPrice() %></p>
<p class="bookInfo"><a href="#" onClick="window.open('<%= cartURL %>','s','width=300,height=300,scrollbars=yes,resizeable=yes,ststus=yes');"><img src="source/cart.gif" width="130" height="25" border="0"></a></p></td>
<% } else { %>
<td width="23%" height="200"> </td>
<td width="22%" height="200"> </td>
<% } %>
</tr>
<tr valign="top">
<td colspan="6" > <p>
</p> <p>
</p></td>
</tr>
<tr valign="top">
<td > </td>
BookInf book= (BookInf)booklist.elementAt(index+2);
String imgURL="source/"+book.getId()+".JPG";
String commentURL="/bookshop/bookComment.jsp?bookId="+book.getId();
String cartURL="/bookshop/addCart.jsp?bookId="+book.getId();
%>
<td width="23%" ><a href="#" onClick="window.open('<%= commentURL %>','s','width=850,height=600,scrollbars=yes,resizeable=yes,ststus=yes');"><img src=<%= imgURL %> width="135" height="200" border="0" ></a></td>
<td width="22%" ><p class="bookInfo">书名:<%= book.getName() %></p>
<p class="bookInfo">作者:<%= book.getAuthor() %></p>
<p class="bookInfo">出版社:<%= book.getPublisher() %></p>
<p class="bookInfo">类别:<%= book.getType() %></p>
<p class="bookInfo">单价:¥<%= book.getPrice() %></p>
<p class="bookInfo"><a href="#" onClick="window.open('<%= cartURL %>','s','width=300,height=300,scrollbars=yes,resizeable=yes,ststus=yes');"><img src="source/cart.gif" width="130" height="25" border="0"></a></p></td>
<% } else { %>
<td width="23%" height="200"> </td>
<td width="22%" height="200"> </td>
<% } %>
<td > </td>
<% if(index+4<=booklist.size()){
BookInf book= (BookInf)booklist.elementAt(index+3);
String imgURL="source/"+book.getId()+".JPG";
String commentURL="/bookshop/bookComment.jsp?bookId="+book.getId();
String cartURL="/bookshop/addCart.jsp?bookId="+book.getId();
%>
<td width="23%" ><a href="#" onClick="window.open('<%= commentURL %>','s','width=850,height=600,scrollbars=yes,resizeable=yes,ststus=yes');"><img src=<%= imgURL %> width="135" height="200" border="0" ></a></td>
<td width="22%" ><p class="bookInfo">书名:<%= book.getName() %></p>
<p class="bookInfo">作者:<%= book.getAuthor() %></p>
<p class="bookInfo">出版社:<%= book.getPublisher() %></p>
<p class="bookInfo">类别:<%= book.getType() %></p>
<p class="bookInfo">单价:¥<%= book.getPrice() %></p>
<p class="bookInfo"><a href="#" onClick="window.open('<%= cartURL %>','s','width=300,height=300,scrollbars=yes,resizeable=yes,ststus=yes');"><img src="source/cart.gif" width="130" height="25" border="0"></a></p></td>
<% } else { %>
<td width="23%" height="200"> </td>
<td width="22%" height="200"> </td>
<% } %>
</tr>
<tr valign="top">
<td colspan="6" > <p>
</p> <p>
</p></td>
</tr>
<tr valign="top">
<td height="200" > </td>
<% if(index+5<=booklist.size()){
BookInf book= (BookInf)booklist.elementAt(index+4);
String imgURL="source/"+book.getId()+".JPG";
String commentURL="/bookshop/bookComment.jsp?bookId="+book.getId();
String cartURL="/bookshop/addCart.jsp?bookId="+book.getId();
%>
<td width="23%" ><a href="#" onClick="window.open('<%= commentURL %>','s','width=850,height=600,scrollbars=yes,resizeable=yes,ststus=yes');"><img src=<%= imgURL %> width="135" height="200" border="0" ></a></td>
<td width="22%" ><p class="bookInfo">书名:<%= book.getName() %></p>
<p class="bookInfo">作者:<%= book.getAuthor() %></p>
<p class="bookInfo">出版社:<%= book.getPublisher() %></p>
<p class="bookInfo">类别:<%= book.getType() %></p>
<p class="bookInfo">单价:¥<%= book.getPrice() %></p>
<p class="bookInfo"><a href="#" onClick="window.open('<%= cartURL %>','s','width=300,height=300,scrollbars=yes,resizeable=yes,ststus=yes');"><img src="source/cart.gif" width="130" height="25" border="0"></a></p></td>
<% } else { %>
<td width="23%" height="200"> </td>
<td width="22%" height="200"> </td>
<% } %>
<td height="200" > </td>
<% if(index+6<=booklist.size()){
BookInf book= (BookInf)booklist.elementAt(index+5);
String imgURL="source/"+book.getId()+".JPG";
String commentURL="/bookshop/bookComment.jsp?bookId="+book.getId();
String cartURL="/bookshop/addCart.jsp?bookId="+book.getId();
%>
<td width="23%" ><a href="#" onClick="window.open('<%= commentURL %>','s','width=850,height=600,scrollbars=yes,resizeable=yes,ststus=yes');"><img src=<%= imgURL %> width="135" height="200" border="0" ></a></td>
<td width="22%" ><p class="bookInfo">书名:<%= book.getName() %></p>
<p class="bookInfo">作者:<%= book.getAuthor() %></p>
<p class="bookInfo">出版社:<%= book.getPublisher() %></p>
<p class="bookInfo">类别:<%= book.getType() %></p>
<p class="bookInfo">单价:¥<%= book.getPrice() %></p>
<p class="bookInfo"><a href="#" onClick="window.open('<%= cartURL %>','s','width=300,height=300,scrollbars=yes,resizeable=yes,ststus=yes');"><img src="source/cart.gif" width="130" height="25" border="0"></a></p></td>
<% } else { %>
<td width="23%" height="200"> </td>
<td width="22%" height="200"> </td>
<% } %>
</tr>
<tr valign="top">
<td height="23" colspan="6" ><div align="center">
<p> </p>
<%
String aft="/bookshop/index.jsp?pg="+Integer.toString(index/6+2);
String pre="/bookshop/index.jsp?pg="+Integer.toString(index/6);
if(pg.equals("1")){
if(Integer.parseInt(pg)<pgSum){
%>
<p>上一页 共<%= pg %>/<%= pgSum %>页 <a href=<%= aft %>>下一页 </a></p>
<% }else{ %>
<tr valign="top">
<td height="23" colspan="6" ><div align="right">
<p>上一页 共<%= pg %>/<%= pgSum %>页 下一页 </p>
<% }
} else {
if(Integer.parseInt(pg)<pgSum){
%>
<p><a href=<%= pre %>>上一页</a> 共<%= pg %>/<%= pgSum %>页 <a href=<%= aft %>>下一页 </a></p>
<% } else {
%>
<p><a href=<%= pre %>>上一页</a> 共<%= pg %>/<%= pgSum %>页 下一页</p>
<% }
} %>
</div></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<jsp:include page="/utility/copyRight.jsp" />
</div>
<br>
<jsp:include page="/utility/scriptMenuitem.jsp" />
</body>
<% } %>
</html>
谢谢大家了