谁有实现在网页上像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.SQLException ee)
{
return false;
}
return true;
}
public java.sql.Statement createStatement()
{
try
{
return this.gConnect.createStatement();
}
catch (Exception e) {}
return this.gStatement;
}
public void close()
{
this.disconnect();
}
public void closeAbort()
{
this.disconnectA();
}
}
[解决办法]
有代码但是不方便给
不过实现方法好像还挺简单的
节点前面的图标和虚线,其实都是图片,每一个父节点都对应一个div,用javascript控制鼠标点击后的,div的显示和隐藏
[解决办法]
一张表,
id name title url 父节点.
1 部门一 0
2 部门二 0
3 子部门1 1
4 子部门2 2
5 子子部门1 3
...
这样类似,其空我没实现过.只是听说过.:)
[解决办法]
楼主不要着急,我给你推荐一个
xloadtree
开源的,简单实用