谁有实现在网页上像csdn左边的目录树样式的的代码啊?(十万火急)
节点必须是动态的从数据库里面获取!
------解决方案--------------------一个简单的jsp树型结构示例(jsp+weblogic+oracle)
数据表结构:
create table TreeExample(f_id number(9,0) not null unique, f_treename varchar2(16), f_fatherid number(9,0) not null);
commit
insert into TreeExample values(1, '树型结构示例 ', 0);
insert into TreeExample values(2, '子树一 ', 1);
insert into TreeExample values(3, '子树二 ', 1);
insert into TreeExample values(4, '子树三 ', 1);
insert into TreeExample values(5, '子树一的子树 ', 2);
连接数据库的javabean代码:
package exampleTree;
import java.sql.*;
import weblogic.jdbc.vendor.oracle.OracleThinClob;
//import oracle.sql.*;
//import oracle.jdbc.driver.*;
import java.io.*;
import java.util.*;
public class DBConn{
protected Connection gConnect;
public Statement gStatement;
protected boolean gConnected=false;
public static final String POOLNAME= "TreeExample ";
public DBConn(){
}
public boolean connect(){
return this.connect(POOLNAME);
}
public boolean connect(String poolname)
{
return this.connect(poolname, true);
}
public boolean connect(boolean bReadOnly)
{
return this.connect(POOLNAME, bReadOnly);
}
public boolean connect(String poolname, boolean bReadOnly)
{
if (!gConnected)
{
try
{
weblogic.jdbc.pool.Driver myDriver = (weblogic.jdbc.pool.Driver)Class.forName( "weblogic.jdbc.pool.Driver ").newInstance();
this.gConnect = myDriver.connect( "jdbc:weblogic:pool: "+poolname, null);
}
catch (Exception ex)
{
System.out.println((new java.util.Date()) + "sql connect error: "+ex.getMessage());
return false;
}
gConnected = true;
}
return true;
}
public boolean disconnect()
{
if(gStatement==null) return false;
try
{
gConnect.commit();
gStatement.close();
}
catch (
java.sql.SQLException ee)
{
return false;
}
finally
{
this.disconnectA();
}
return true;
}
protected boolean disconnectA()
{
if (!gConnected) return true;
gConnected = false;
if(gConnect==null) return true;
try
{
gConnect.close();
}
catch(java.sql.
SERVLET WEB.XML 配置有关问题