| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1411 人关注过本帖
标题:The method initFromRs(ResultSet) in the type Article is not applicable ...
只看楼主 加入收藏
刺客八月
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2014-4-3
收藏
 问题点数:0 回复次数:1 
The method initFromRs(ResultSet) in the type Article is not applicable for the
看尚学堂的视频在学bbs,代码如下
<%@page pageEncoding="GBK"%>
<%@page import="java.sql.*, *,com.bjsxt.bbs.*, java.util.*" %>
<%!
private void tree(List<Article> articles, Connection conn, int id, int grade){
    String sql = "select * from article where pid = " +id;
    Statement stmt = DB.createStmt(conn);
    ResultSet rs = DB.executeQuery(stmt, sql);
    try{
    while(rs.next()){
    Article a = new Article();
    a.initFromRs(rs);   //报错处
    a.setGrade(grade);
    articles.add(a);
    if(!a.isLeaf()){
       tree(articles,conn, a.getId(), grade+1);
    }
   
    }
    }catch (SQLException e){
    e.printStackTrace();
    }finally{
          DB.close(rs);
          DB.close(stmt);
     
     }
}
 %>
 
 <%
 List<Article> articles = new ArrayList<Article>();
 Connection conn = DB.getConn();
 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.
<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. 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. 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.发表新主题</a> <a href="http://bbs.
        </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.上一页</a> | <a href="http://bbs. class="">1</a> <a href="http://bbs. class="jive-current">2</a> <a href="http://bbs. class="">3</a> <a href="http://bbs. class="">4</a> <a href="http://bbs. class="">5</a> <a href="http://bbs. class="">6</a> | <a href="http://bbs.下一页</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> 作者
                        </nobr> </th>
                    <th class="jive-view-count"> <nobr> 浏览
                        </nobr> </th>
                    <th class="jive-msg-count" nowrap="nowrap"> 回复 </th>
                    <th class="jive-last" nowrap="nowrap"> 最新帖子 </th>
                  </tr>
                </thead>
                <tbody>
                <%
                for(Iterator<Article> it = articles.iterator();it.hasNext();) {
                   Article a= it.next();
                   String preStr = "";
                   for(int i = 0;i<a.getGrade(); i++){
                      preStr += "----";
                   }
                 %>
                  <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%"> 
                     
                     
                     
                     
                       </td>
                    <td class="jive-thread-name" width="95%"><a id="jive-thread-1" href="articleDetail.jsp? id=<%=a.getId() %>  "><%= preStr + a.getTitle() %></a></td>
                    <td class="jive-author" nowrap="nowrap" width="1%"><span class=""> <a href="http://bbs. </span></td>
                    <td class="jive-view-count" width="1%"> 88</td>
                    <td class="jive-msg-count" width="1%"> 5</td>
                    <td class="jive-last" nowrap="nowrap" width="1%"><div class="jive-last-post"> <%=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(a.getPdate()) %> <br>
                        by: <a href="http://bbs. title="jingjiangjun" style="">wjfby »</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%"> 
                     
                     
                     
                     
                       </td>
                    <td class="jive-thread-name" width="95%"><a id="jive-thread-2" href="http://bbs.请 兄弟们指点下那里 错误,,,</a></td>
                    <td class="jive-author" nowrap="nowrap" width="1%"><span class=""> <a href="http://bbs. </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. title="downing114" style="">downing114 »</a> </div></td>
                  </tr>
                  --%>
                  <%} %>
                </tbody>
              </table>
            </div>
          </div>
          <div class="jive-legend"></div></td>
      </tr>
    </tbody>
  </table>
  <br>
  <br>
</div>
</body>
</html>
不知道该怎么解决
搜索更多相关主题的帖子: article private method import where 
2014-04-03 16:11
刺客八月
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2014-4-3
收藏
得分:0 
报错提示
The method initFromRs(ResultSet) in the type Article is not applicable for the arguments (ResultSet)    article.jsp    /BBS/WebRoot    line 11    JSP Problem
2014-04-03 16:12
快速回复:The method initFromRs(ResultSet) in the type Article is not appli ...
数据加载中...
 
   



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

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