我定义了一个bbs.sql文件运行,和一个jsp文件,结果和我做的不一样,代码如下,求调试。drop table article;create table article
(
id number primary key ,
title varchar2(4000),
cont varchar2(4000),
pid number,
pdate date, 
isleaf number(1), --0代表非叶子节点,1代表叶子节点
alevel number(2)
)CREATE SEQUENCE article_sequence
INCREMENT BY 1 -- 每次加几个
START WITH 1 -- 从1开始计数
MAXVALUE 1.0E28 -- 设置最大值
MINVALUE 1 
NOCYCLE  -- 一直累加,不循环
CACHE 40 -- 不建缓冲区
NOORDER;CREATE TRIGGER TRG_ADD_TUSER  BEFORE
INSERT ON article FOR EACH ROW WHEN (new.id is null)
begin
select article_sequence.nextval into: new.id from dual;
end;insert into article values (article_sequence.nextval, '蚂蚁大战大象', '蚂蚁大战大象',0,sysdate, 0,  0);
insert into article values (article_sequence.nextval, '大象被打趴下了', '大象被打趴下了',1, sysdate,0,1);
insert into article values (article_sequence.nextval, '蚂蚁也不好过','蚂蚁也不好过', 2, sysdate, 1,  2);
insert into article values (article_sequence.nextval, '瞎说', '瞎说',2,sysdate, 0,  2);
insert into article values (article_sequence.nextval, '没有瞎说', '没有瞎说',4,sysdate, 1,  3);
insert into article values (article_sequence.nextval, '怎么可能', '怎么可能',1,sysdate,  0, 1);
insert into article values (article_sequence.nextval, '怎么没可能','怎么没可能', 6, sysdate,1,  2);
insert into article values (article_sequence.nextval, '可能性是很大的','可能性是很大的', 6,sysdate, 1,  2);
insert into article values (article_sequence.nextval, '大象进医院了','大象进医院了', 2, sysdate,0,  2);
insert into article values (article_sequence.nextval, '护士是蚂蚁','护士是蚂蚁', 9, sysdate,1,  3);
commit;<%@ page language="java" contentType="text/html; charset=gbk"
    pageEncoding="gbk"%>
<%@ page import="java.sql.*" %><%!
String str = "";
private void tree(Connection conn, int id, int level) {
Statement st = null;
ResultSet rs = null;
String preStr = "";
for(int i=0; i<level; i++) {
preStr += "----";
}
try {

st = conn.createStatement();
String sql = "select * from article where pid = " + id;
rs = st.executeQuery(sql);
String strLogin = "";

while(rs.next()) {

str += "<tr><td>" + rs.getInt("id") + "</td><td>" +
       preStr + rs.getString("title") + "</td></tr>";
if(rs.getInt("isleaf") != 0) {
tree(conn, rs.getInt("id"), level+1);
}
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if(rs != null) {
rs.close();
rs = null;
}
if(st != null) {
st.close();
st = null;
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
%>
<%
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL", "system", "1125919HAIxing");
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("select * from article where pid = 0");
while(rs.next()) {
str += "<tr><td>" + rs.getInt("id") + "</td><td>" +
       rs.getString("title") + "</td></tr>";
if(rs.getInt("isleaf") != 0) {
tree(conn, rs.getInt("pid"), 1);
}
}
rs.close();
st.close();
conn.close();
 %>
<!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=gbk">
<title>Insert title here</title>
</head>
<body><table border="1">
<%= str %>
 
</table>
</body>
</html>