List接口版本不兼容?

zfq642773391 2008-11-05 03:03:58
我在学jsp时遇到一个问题 自己总是解决不了 问题如下 望指教:

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);
%>

List接口总显示这种用法仅在1.5使用 而我的jdk是1.6 不知该怎样转换
...全文
76 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhj92lxs 2008-11-05
  • 打赏
  • 举报
回复
同样的问题?
tt2451 2008-11-05
  • 打赏
  • 举报
回复
....

所有的<Article>都去掉试试

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧