请教一下jsp高手
String str="";
private void tree(Connection conn,int id,int level){
Statement stmt=null;
ResultSet rs=null;
String preStrce="";
for(int i=0;i<level;i++){
preStrce +="----";
}
try{
stmt=conn.createStatement();
String sql="select*from article where pid="+id;
rs=stmt.executeQuery(sql);
while(rs.next()){
str+="<tr><td>"+rs.getInt("id")+"</td>td>"+
preStrce+"<a href=ShowAriticleDetail.jsp>"+rs.getString("title")+"</a>"+"</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(stmt!=null){
stmt.close();
stmt=null;
}
}catch(SQLException e){
e.printStackTrace();
}
}
}
%>
------解决方案--------------------