您的位置:程序门 -> java -> web 开发



jsp调试遇到问题,求救!!


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


jsp调试遇到问题,求救!![已结贴,结贴人:javatotheworld]
发表于:2007-05-17 00:02:25 楼主
我的网上购书系统做的差不多了,但是在编译时遇到了问题好象读javabean文件bookinf.class时有错误,难道是bookinf.class编译后有错误,还是放的文件路径有问题,我的bean文件放在root/bookshop/web-inf/classes/bean/bookinf.class,运行index.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:   unable   to   compile   class   for   jsp

generated   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)
发表于:2007-05-17 09:44:081楼 得分:0
急着搞这个,大家给个帮助啊
发表于:2007-05-17 09:56:492楼 得分:5
看看是不是你页面上的引用的包路径没有写正确
发表于:2007-05-17 10:00:563楼 得分:10
路径有错。我有日子没用jsp了啊。不过我记得import.后面应该是bean的路径啊,默认是在web/inf下的,但是你存放的是web-inf/classes/bean/bookinf.class,
却写的是,import   bean.bookinf,应该是import   classes.bean.bookinf
发表于:2007-05-17 10:07:274楼 得分:5
加入tools.jar试试
发表于:2007-05-17 23:20:295楼 得分:0
我在classpath下把tools.jar加了啊,还是不行
发表于:2007-05-18 00:01:116楼 得分:0
这是我的index.jsp,网站的主页如下:
<%@   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 ">  
发表于:2007-05-18 00:01:357楼 得分:0
<div   id= "breadcrumb ">  
                    <table   width= "100% "   border= "0 ">
                  <tr>
                      <%   string   requesturl=   request.getrequesturi();
          string   param=request.getquerystring();  
    string   hidaddr= "/bookshop/menuhidden?jspurl= "   +   requesturl   + "&param= "+   param   ;
    string   showaddr= "/bookshop/menushow?jspurl= "   +   requesturl   + "&param= "+   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> &nbsp;  
                        </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 "> 单价:&yen; <%=   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 "> &nbsp; </td>
  <td   width= "22% "   height= "200 "> &nbsp; </td>
    <%   }   %>
   
    <td   width= "5% "   > &nbsp; </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 "> 单价:&yen; <%=   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 "> &nbsp; </td>
  <td   width= "22% "   height= "200 "> &nbsp; </td>
    <%   }   %>
               
</tr>  
               
<tr   valign= "top ">  
                    <td   colspan= "6 "   >   <p> &nbsp;  
                        </p>   <p> &nbsp;  
                        </p> </td>  
                    </tr>
             
        <tr   valign= "top ">
                    <td   > &nbsp; </td>
发表于:2007-05-18 00:15:368楼 得分:0

发表于:2007-05-18 00:16:059楼 得分:0
<%   if(index+3 <=booklist.size()){
    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 "> 单价:&yen; <%=   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 "> &nbsp; </td>
  <td   width= "22% "   height= "200 "> &nbsp; </td>
    <%   }   %>
                   
    <td   > &nbsp; </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 "> 单价:&yen; <%=   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 "> &nbsp; </td>
  <td   width= "22% "   height= "200 "> &nbsp; </td>
    <%   }   %>
               
</tr>  
               
<tr   valign= "top ">  
                    <td   colspan= "6 "   >   <p> &nbsp;  
                        </p>   <p> &nbsp;  
                        </p> </td>  
                    </tr>
               
<tr   valign= "top ">
                    <td   height= "200 "   > &nbsp; </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 "> 单价:&yen; <%=   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 "> &nbsp; </td>
  <td   width= "22% "   height= "200 "> &nbsp; </td>
    <%   }   %>
                   
   
    <td   height= "200 "   > &nbsp; </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 "> 单价:&yen; <%=   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 "> &nbsp; </td>
  <td   width= "22% "   height= "200 "> &nbsp; </td>
    <%   }   %>
               
</tr>
<tr   valign= "top ">
                    <td   height= "23 "   colspan= "6 "   > <div   align= "center ">
                        <p> &nbsp; </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> 上一页&nbsp;&nbsp;&nbsp;共 <%=   pg   %> / <%=   pgsum   %> 页&nbsp;&nbsp;&nbsp; <a   href= <%=   aft   %> > 下一页   </a> </p>
                   
<%   }else{     %>
                <tr   valign= "top ">
                    <td   height= "23 "   colspan= "6 "   > <div   align= "right ">
                     
                        <p> 上一页&nbsp;&nbsp;&nbsp;共 <%=   pg   %> / <%=   pgsum   %> 页&nbsp;&nbsp;&nbsp;下一页   </p>
                   
<% }  
}   else   {  
if(integer.parseint(pg) <pgsum){  
%>

                        <p> <a   href= <%=   pre   %> > 上一页 </a> &nbsp;&nbsp;&nbsp;共 <%=   pg   %> / <%=   pgsum   %> 页&nbsp;&nbsp;&nbsp; <a   href= <%=   aft   %> > 下一页   </a> </p>
                   
<% }   else   {
%>

                        <p> <a   href= <%=   pre   %> > 上一页 </a> &nbsp;&nbsp;&nbsp;共 <%=   pg   %> / <%=   pgsum   %> 页&nbsp;&nbsp;&nbsp;下一页 </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>
发表于:2007-05-21 22:18:3210楼 得分:0
终于搞好了,是我的jdk版本的问题!
谢谢大家了


快速检索

热门点击