java吧 关注:1,301,593贴子:12,849,292
  • 3回复贴,共1

求助,已经改了好几遍,也看了好几遍了,就职不知道哪里错了~~

只看楼主收藏回复

Tonmcat报错代码如下:
type Exception report
message Unable to compile class for JSP:
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: An error occurred at line: 7 in the jsp file: /article.jspsql cannot be resolved to a variable
4:private void tree(Set<Article> articles,Connection conn,int id ,int grsde) {
5: String aql = "select * from article where pid =" + id;
6: Statement stm = DB.createStm(conn);
7: ResultSet rs = DB.createRs(stm,sql);
8: try{
9: while(rs.next()){
10: Article a = new Article();
An error occurred at line: 19 in the jsp file: /article.jspgrade cannot be resolved to a variable
16: a.setPdate(rs.getTimestamp("pdate"));
17: articles.add(a);18: if(!a.isLeaf()) {
19: tree(articles , conn , a.getId() , grade+1);
20: }
21: }
22: }catch(SQLException e) {
An error occurred at line: 105 in the jsp file: /article.jsparticles cannot be resolved
102: <tbody>
103:
104: <%
105: for(Iterator<Article> it = articles.iterator();it.hasNext();) {
106: Article a = it.next();
107: %>
108: <tr class="jive-even">


IP属地:安徽1楼2014-03-28 14:47回复

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


    IP属地:上海来自Android客户端2楼2014-03-28 14:49
    回复
      2026-04-18 18:27:02
      广告
      不感兴趣
      开通SVIP免广告
      全部代码如下:
      <%@page pageEncoding="gbk"%>
      <%@page import="java.sql.* , com.wzl.bbs.*,java.util.*" %>
      <%!
      private void tree(Set<Article> articles,Connection conn,int id ,int grsde) {
      String aql = "select * from article where pid =" + id;
      Statement stm = DB.createStm(conn);
      ResultSet rs = DB.createRs(stm,sql);
      try{
      while(rs.next()){
      Article a = new Article();
      a.setId(rs.getInt("id"));
      a.setPid(rs.getInt("pid"));
      a.setRootid(rs.getInt("rootid"));
      a.setTitle(rs.getString("title"));
      a.setLeaf(rs.getInt("isLeaf") == 0 ? true : false);
      a.setPdate(rs.getTimestamp("pdate"));
      articles.add(a);
      if(!a.isLeaf()) {
      tree(articles , conn , a.getId() , grade+1);
      }
      }
      }catch(SQLException e) {
      e.printStackTrace();
      }
      }
      %>
      Set<Article> articles = new HashSeA<Article>();
      Connection conn = DB.createCon();
      tree(articles,conn,0,0)
      DB.close(conn);
      <%
      %>
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
      <html>
      <head>
      <title>Java|Java世界_中文论坛|ChinaJavaWorld技术论坛 : Java语言*初级版</title>
      <meta http-equiv="content-type" content="text/html; charset=GBK">
      <link rel="stylesheet" type="text/css" href="images/style.css" title="Integrated Styles">
      <script language="JavaScript" type="text/javascript" src="images/global.js"></script>
      <link rel="alternate" type="application/rss+xml" title="RSS" href="http://bbs.chinajavaworld.com/rss/rssmessages.jspa?forumID=20">
      <script language="JavaScript" type="text/javascript" src="images/common.js"></script>
      </head>
      <body>
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tbody>
      <tr>
      <td width="140"><a href="http://bbs.chinajavaworld.com/index.jspa"><img src="images/header-left.gif" alt="Java|Java世界_中文论坛|ChinaJavaWorld技术论坛" border="0"></a></td>
      <td><img src="images/header-stretch.gif" alt="" border="0" height="57" width="100%"></td>
      <td width="1%"><img src="images/header-right.gif" alt="" border="0"></td>
      </tr>
      </tbody>
      </table>
      <br>
      <div id="jive-forumpage">
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tbody>
      <tr valign="top">
      <td width="98%"><p class="jive-breadcrumbs">论坛: Java语言*初级版
      (模仿)</p>
      <p class="jive-description"> 探讨Java语言基础知识,基本语法等 大家一起交流 共同提高!谢绝任何形式的广告 </p>
      </td>
      </tr>
      </tbody>
      </table>
      <div class="jive-buttons">
      <table summary="Buttons" border="0" cellpadding="0" cellspacing="0">
      <tbody>
      <tr>
      <td class="jive-icon"><a href="http://bbs.chinajavaworld.com/post%21default.jspa?forumID=20"><img src="images/post-16x16.gif" alt="发表新主题" border="0" height="16" width="16"></a></td>
      <td class="jive-icon-label"><a id="jive-post-thread" href="http://bbs.chinajavaworld.com/post%21default.jspa?forumID=20">发表新主题</a> <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&amp;isBest=1"></a></td>
      </tr>
      </tbody>
      </table>
      </div>
      <br>
      <table border="0" cellpadding="3" cellspacing="0" width="100%">
      <tbody>
      <tr valign="top">
      <td><span class="nobreak"> 页:
      1,316 - <span class="jive-paginator"> [ <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&amp;start=0&amp;isBest=0">上一页</a> | <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&amp;start=0&amp;isBest=0" class="">1</a> <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&amp;start=25&amp;isBest=0" class="jive-current">2</a> <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&amp;start=50&amp;isBest=0" class="">3</a> <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&amp;start=75&amp;isBest=0" class="">4</a> <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&amp;start=100&amp;isBest=0" class="">5</a> <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&amp;start=125&amp;isBest=0" class="">6</a> | <a href="http://bbs.chinajavaworld.com/forum.jspa?forumID=20&amp;start=50&amp;isBest=0">下一页</a> ] </span> </span> </td>
      </tr>
      </tbody>
      </table>
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tbody>
      <tr valign="top">
      <td width="99%"><div class="jive-thread-list">
      <div class="jive-table">
      <table summary="List of threads" cellpadding="0" cellspacing="0" width="100%">
      <thead>
      <tr>
      <th class="jive-first" colspan="3"> 主题 </th>
      <th class="jive-author"> <nobr> 作者
      &nbsp; </nobr> </th>
      <th class="jive-view-count"> <nobr> 浏览
      &nbsp; </nobr> </th>
      <th class="jive-msg-count" nowrap="nowrap"> 回复 </th>
      <th class="jive-last" nowrap="nowrap"> 最新帖子 </th>
      </tr>
      </thead>


      IP属地:安徽3楼2014-03-28 14:50
      回复
        <tbody>
        <%
        for(Iterator<Article> it = articles.iterator();it.hasNext();) {
        Article a = it.next();
        %>
        <tr class="jive-even">
        <td class="jive-first" nowrap="nowrap" width="1%"><div class="jive-bullet"> <img src="images/read-16x16.gif" alt="已读" border="0" height="16" width="16">
        <!-- div-->
        </div></td>
        <td nowrap="nowrap" width="1%">&nbsp;
        &nbsp;</td>
        <td class="jive-thread-name" width="95%"><a id="jive-thread-1" href="http://bbs.chinajavaworld.com/thread.jspa?threadID=744236&amp;tstart=25">初学java遇一难题!!望大家能帮忙一下 谢谢了</a></td>
        <td class="jive-author" nowrap="nowrap" width="1%"><span class=""> <a href="http://bbs.chinajavaworld.com/profile.jspa?userID=226030">fei870407</a> </span></td>
        <td class="jive-view-count" width="1%"> 104</td>
        <td class="jive-msg-count" width="1%"> 5</td>
        <td class="jive-last" nowrap="nowrap" width="1%"><div class="jive-last-post"> 2007-9-13 上午9:31 <br>
        by: <a href="http://bbs.chinajavaworld.com/thread.jspa?messageID=780182#780182" title="jingjiangjun" style="">jingjiangjun &#187;</a> </div></td>
        </tr>
        <tr class="jive-odd">
        <td class="jive-first" nowrap="nowrap" width="1%"><div class="jive-bullet"> <img src="images/read-16x16.gif" alt="已读" border="0" height="16" width="16">
        <!-- div-->
        </div></td>
        <td nowrap="nowrap" width="1%">&nbsp;
        &nbsp;</td>
        <td class="jive-thread-name" width="95%"><a id="jive-thread-2" href="http://bbs.chinajavaworld.com/thread.jspa?threadID=744234&amp;tstart=25">请 兄弟们指点下那里 错误,,,</a></td>
        <td class="jive-author" nowrap="nowrap" width="1%"><span class=""> <a href="http://bbs.chinajavaworld.com/profile.jspa?userID=226028">403783154</a> </span></td>
        <td class="jive-view-count" width="1%"> 52</td>
        <td class="jive-msg-count" width="1%"> 2</td>
        <td class="jive-last" nowrap="nowrap" width="1%"><div class="jive-last-post"> 2007-9-13 上午8:40 <br>
        by: <a href="http://bbs.chinajavaworld.com/thread.jspa?messageID=780172#780172" title="downing114" style="">downing114 &#187;</a> </div></td>
        </tr>
        <%
        }
        %>
        </tbody>
        </table>
        </div>
        </div>
        <div class="jive-legend"></div></td>
        </tr>
        </tbody>
        </table>
        <br>
        <br>
        </div>
        </body>
        </html>


        IP属地:安徽4楼2014-03-28 14:50
        回复