interator迭代运行后什么也不显示

yxtq666 yxtq666 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
新手跟着视频学的,运行后什么也不显示
index.jsp
<%!
private void tree(List<Article> articles,Connection conn,int id,int grade){
String sql = "select*from article where pid = "+ id;
Statement stmt = DB.getStmt(conn);
ResultSet rs = DB.executeQuery(stmt,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.getDate("pdate"));
a.setGrade(grade);
articles.add(a);
if(!a.isLeaf()){
tree(articles,conn,a.getId(),grade + 1);
}
}

}catch(SQLException e){
e.printStackTrace();
}
}
%>
<%
List<Article> articles = new ArrayList<Article>();
Connection conn = DB.getConn();
tree(articles,conn,0,0);
DB.close(conn);
%>

<body>

<% for(Iterator<Article> it = articles.iterator(); it.hasNext(); ) {
Article a = it.next();
%>
<tr>This is my JSP page.</tr>
<%
} %>
Article.java
...全文

相关推荐

C++迭代器介绍(iterator、const_iterator、reverse_interator、const_reverse_interator)

概念:C++的一种机制,用来遍历标准模板库容器中的元素,是一种”智能”指针 一、迭代器的特点 迭代器是一种智能指针,具有遍历复杂数据结构的能力 不同的容器有不一样的内部结构,因此会有一样的迭代器类型 迭代器定义后,并不属于某一实例容器对象,只要是属于该迭代器类型的容器类型都可用 迭代器的分类 C++的STL定义了5种迭代器 输入迭代器:提供了对其指向元素的只读操作以及前++和后++操作符 输出迭代器:提供了对其指向元素的写操作和++操作符 向前迭代器:具有++操作符 双向迭代器:既具有++操作符也具有–操作符 随机访问迭代器:是一般的迭代器,既可以随机的实现跳

weixin_38608693

JSP Interator(迭代)

一个 JAVA 文件。

adware2008

设计模式之Interator模式

NULL 博文链接:https://skyuck.iteye.com/blog/497159

weixin_38669628

estruturas-de-dados-1:Feevale中数据结构类的存储库

达多斯大街1 Feevale中“数据结构”类的存储库。 练习: 练习1- 练习使用C ++在控制台中打印ASCII表。 它由一个应用程序类和一个Interator组成(实际上,它只是一个概念上的迭代器,因为它实际上并不对任何事物进行迭代)。 想法只是实践一些最初的面向对象的C ++概念。

余木脑袋

常见设计模式视频及示例代码

常见的设计模式视频教程及相关示例代码、资料 工厂模式系列 动态代理模式 strategy模式 interator 责任链

zhwITbird
评论 1
收藏 已收藏
分享
返回顶部
yxtq666
JavaScript 87,983 成员 224,681 内容