- 浏览: 7197 次
最近访客 更多访客>>
最新评论
-
ttxiangyou:
呵呵,这个是乎有点乱呢?可以发到我邮箱吗?
zou_wei_f ...
不用迭代算法而快速实现的jsp树结构 -
wangjian3q:
xDataTree.js 给我一份呢??谢谢您了
wangji ...
不用迭代算法而快速实现的jsp树结构
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0049)http://duduwolf.360doc.com/showWeb/0/0/30580.aspx -->
<HTML><HEAD><TITLE>不用迭代算法而快速实现的jsp树结构</TITLE>
<META http-equiv=Content-Type content=text/html;charset=gb2312>
<META content=360doc name=classification>
<META content=不用迭代算法而快速实现的jsp树结构 name=keywords>
<META content=不用迭代算法而快速实现的jsp树结构 name=description>
<META content=www.360doc.com name=author>
<STYLE>.Title01 {
FONT-SIZE: 12px; COLOR: #004499; LINE-HEIGHT: 20px; FONT-FAMILY: arial, helvetica
}
.Title01 A {
COLOR: #0077cc; TEXT-DECORATION: none
}
.Title01 A:hover {
COLOR: #997722; TEXT-DECORATION: none
}
.Title01 A:visited {
TEXT-DECORATION: none
}
.TitleDate {
FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #999999; FONT-FAMILY: arial, helvetica
}
.TitleContent {
FONT-SIZE: 12px; COLOR: #000000; LINE-HEIGHT: 20px; FONT-FAMILY: arial, helvetica
}
.TitleContent A {
COLOR: #0077cc; TEXT-DECORATION: none
}
.TitleContent A:hover {
COLOR: #997722; TEXT-DECORATION: none
}
.TitleContent A:visited {
TEXT-DECORATION: none
}
.p2 {
FONT-SIZE: 12px; LINE-HEIGHT: 24px
}
.p2 A:visited {
COLOR: #261cdc
}
.p3 {
FONT-FAMILY: arial
}
.p3 {
FONT-SIZE: 9pt; LINE-HEIGHT: 18px
}
</STYLE>
<SCRIPT language=javascript>
<!--
//-->
</SCRIPT>
<META content="MSHTML 6.00.2800.1226" name=GENERATOR></HEAD>
<BODY text=#000000 bottomMargin=0 vLink=#261cdc link=#261cdc bgColor=#ffffff
topMargin=1>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD><A href="http://duduwolf.360doc.com/index.aspx" target=_blank><IMG
src="不用迭代算法而快速实现的jsp树结构.files/iDocumentBanner.gif" border=0></A></TD>
<TD align=middle><A href="http://duduwolf.360doc.com/index.aspx"
target=_blank><IMG src="不用迭代算法而快速实现的jsp树结构.files/360docAd.gif"
border=0></A></TD></TR>
<TR>
<TD align=middle height=3></TD></TR>
<TR>
<TD colSpan=2>
<TABLE height=22 cellSpacing=0 cellPadding=0 width="100%" border=0
valign="top">
<TBODY>
<TR bgColor=#fffcf4 height=22>
<TD class=p2>不用迭代算法而快速实现的jsp树结构(转载)&<FONT color=#6f6f6f
size=1>05.11.14 </FONT>&<FONT color=#6f6f6f>from </FONT><A
href="http://duduwolf.360doc.com/UserHome/677.aspx">smoking_boy</A> <NOBR><A
href="http://www.chinaitpower.com/A/2005-06-16/150031.html">来源</A> </NOBR>
</TD>
<TD class=p2 align=right width=120><A
href="http://duduwolf.360doc.com/showWeb/0/1/31209.aspx">上一篇</A>&&&&<A
href="http://duduwolf.360doc.com/showWeb/0/1/30257.aspx">下一篇</A>&&&&</TD></TR></TBODY></TABLE>
<TABLE height=22 cellSpacing=0 cellPadding=0 width="100%" border=0
valign="top">
<TBODY>
<TR bgColor=#fdf9e7 height=22>
<TD class=p2></TD>
<TD class=p2 align=right><FONT face=楷体_GB2312>这篇文章不错,<A
href="http://duduwolf.360doc.com/ReSaveMenu.aspx?ArticleID=30580">我也要收藏</A>&&&&</FONT>
</TD></TR></TBODY></TABLE></TD></TR>
<TR></TR></TBODY></TABLE>
<TABLE>
<TBODY>
<TR>
<TD>
<P>在web页面上实现树状结构,有点麻烦.<BR>在最近的一个MIS<A
href="http://www.chinaitpower.com/System/index.html"
target=_blank>系统</A>的开发中,我们项目组大量用到了树结构:比如人员的选择,单位的选择等待.<BR>这个MIS<A
href="http://www.chinaitpower.com/System/index.html"
target=_blank>系统</A>所用的<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>是oracle 9i.& oracle 9i 的<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>支持迭代查询.我们的树是由牛人彭越写的,不过<BR>也参照了<A
href="http://www.chinaitpower.com/Net/index.html"
target=_blank>网络</A>上比较著名的xtree(可以到此下载:http://webfx.eae.net/),他的树算法支持无限级的树结构,不过性能好像<BR>很慢.我持保留态度.<BR>他用到的关键技术就是这句话:<BR>String
<A href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A> = "select dwxh,dwbh,dwmc,dwfxh,level cc from xt_dw
connect by& prior dwxh = dwfxh start with dwfxh = 0";<BR>可是许多<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>不支持迭代查询,并且迭代查询速度真是不能忍受.有什么更好的办法呢.下面说说我的解决方案.</P>
<P>一:需求的提出<BR>1:客户需要一个关于部门人员的树结构,<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>为my<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>4.1<BR>2:<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>实现<BR>二:建表:<BR>1:<BR>用户信息表:<BR>各字段为:用户序号,用户编号,用户名称,单位序号,密码,用户登陆号<BR>create
table XT_YH<BR>(<BR>& YHXH& INT(9) NOT NULL auto_increment
PRIMARY KEY,<BR>& YHBH& VARCHAR(30),<BR>& YHMC&
VARCHAR(30),<BR>& DWXH& INT(9),<BR>& PWD&&
VARCHAR(20),<BR>& YHDLH VARCHAR(30)<BR>)<BR>--插入三条测试数据:<BR>--insert
into xt_yh(yhbh,yhmc,dwxh,pwd,yhdlh)
values('licl','李春雷',2,'password','licl')<BR>--insert into
xt_yh(yhbh,yhmc,dwxh,pwd,yhdlh)
values('fengx','冯欣',2,'password','fengx')<BR>--insert into
xt_yh(yhbh,yhmc,dwxh,pwd,yhdlh)
values('wangqx','王庆香',6,'password','wangqx')<BR>2:<BR>单位部门表<BR>各字段为:单位序号,单位编号,单位名称,单位父序号<BR>create
table XT_DW<BR>(<BR>& DWXH& int(9) NOT NULL auto_increment
PRIMARY KEY,<BR>& DWBH& VARCHAR(10),<BR>& DWMC&
VARCHAR(30),<BR>& DWFXH int(9)<BR>)<BR>--插入5条测试数据<BR>--insert into
xt_dw(dwbh,dwmc,dwfxh) values('0100000000','武汉科技局',0);<BR>--insert into
xt_dw(dwbh,dwmc,dwfxh) values('0101000000','人事处',1);<BR>--insert into
xt_dw(dwbh,dwmc,dwfxh) values('0102000000','后勤处',1);<BR>--insert into
xt_dw(dwbh,dwmc,dwfxh) values('0101010000','人事处son1',2);<BR>--insert into
xt_dw(dwbh,dwmc,dwfxh) values('0101020000','人事处son2',2);<BR>--insert into
xt_dw(dwbh,dwmc,dwfxh) values('0102010000','后勤处son1',3);</P>
<P>注意:<BR>为了实现快速的树结构实现,我需要充分利用单位编号DWBH,DWBH才有10位编码,其中,第一第二位表示一级单位,第三第四位表示二级单位,<BR>第五六位表示三级单位...那么10位编码就可以实现五级单位的树结构.<BR>比如:测试数据的树结构如下:<BR>&
1& 武汉科技局:<BR>&2& 人事处<BR>&&3&
人事处son1<BR>&&3& 人事处son2<BR>&2&
后勤处<BR>&&3后勤处son1</P>
<P>其实XT_DW表中的父序号是多余的.不过如果你要用迭代算法来实现,就是必须的<BR>才有10位编码,我只需要一句简单快速的<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>语句就可以实现树结构:<BR>String <A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A> = "select dwxh,dwbh,dwmc,dwfxh from xt_dw order by
dwbh"<BR>这句<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>在几乎所有的<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>平台都能执行,速度也快.<BR>下面贴出采用xtree,用10位编码而不是迭代算法实现的树:</P>
<P>/*******Constants.<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>**********/</P>
<P>package com.lcl.common;</P>
<P>public class Constants {<BR>&<BR>&public static final String
DBDRIVER = "com.my<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>.jdbc.Driver";&&&
//MYSQL驱动<BR>&<BR>&public static final String DBUrl="jdbc:my<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>://localhost/beauoa"; //<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>url<BR>&<BR>&public static final String
USERNAME="root";&&&&&&&&&&&&&&&&&&&&&&
//<A href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>用户名<BR>&<BR>&public static final String
PASSWORD="root";&&&& //<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>密码<BR>&<BR>&<BR>}</P>
<P><BR>/**********DbAccess.<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>****************/</P>
<P>package com.lcl.common;</P>
<P>import <A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>.<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>.*;<BR>import <A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>.lang.*;</P>
<P>/**<BR>&* @author 李春雷<BR>&*<BR>&* TODO
要更改此生成的类型注释的模板,请转至<BR>&* <A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>访问类<BR>&*/<BR>public class DbAccess<BR>{&
<BR>&String strDBDriver = Constants.DBDRIVER;<BR>&String
strDBUrl = Constants.DBUrl;<BR>&String username =
Constants.USERNAME;<BR>&String password =
Constants.PASSWORD;<BR>&private Connection conn =
null;<BR>&private Statement stmt = null;<BR>&ResultSet
rs=null;<BR>&//注册<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>驱动<A
href="http://www.chinaitpower.com/Dev/index.html"
target=_blank>程序</A><BR>&public DbAccess()<BR>&{&
<BR>&&try <BR>&&{&
<BR>&&&Class.forName(strDBDriver);<BR>&&}<BR>&&//异常处理<BR>&&catch(
<A href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>.lang.ClassNotFoundException
e)<BR>&&{<BR>&&&System.err.println("DbAccess():"+e.getMessage());<BR>&&}<BR>&}<BR>&//建立<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>连接及定义数据查询<BR>&public ResultSet
executeQuery(String <A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>)<BR>&{<BR>&&rs=null;<BR>&&try<BR>&&{<BR>&&&conn=DriverManager.getConnection(strDBUrl,username,password);<BR>&&&stmt=conn.createStatement();<BR>&&&rs=stmt.executeQuery(<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>);<BR>&&}<BR>&&catch(SQLException
ex)<BR>&&{<BR>&&&System.err.println("ap.executeQuery:"+ex.getMessage());<BR>&&}<BR>&<BR>&&return
rs;<BR>&}<BR>&//定义数据操库作<BR>&public void
executeUpdate(String <A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>)<BR>&{<BR>&&stmt=null;<BR>&&rs=null;<BR>&&try<BR>&&{<BR>&&&conn=DriverManager.getConnection(strDBUrl,username,password);<BR>&&&stmt=conn.createStatement();<BR>&&&stmt.executeQuery(<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>);<BR>&&&stmt.close();<BR>&&&conn.close();<BR>&&}<BR>&&catch(SQLException
ex)<BR>&&{<BR>&&&System.err.println("ap.executeQuery:"+ex.getMessage());<BR>&&}<BR>&}<BR>&//关闭<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A><BR>&public void
closeStmt()<BR>&{<BR>&&try<BR>&&{<BR>&&&stmt.close();<BR>&&}<BR>&&catch(SQLException
e)<BR>&&{<BR>&&&e.printStackTrace();<BR>&&}<BR>&}<BR>&public
void
closeConn()<BR>&{<BR>&&try<BR>&&{<BR>&&&conn.close();<BR>&&}<BR>&&catch(SQLException
e)<BR>&&{<BR>&&&e.printStackTrace();<BR>&&}<BR>&}<BR>&public
static void main(String[]
args){<BR>&&System.out.println("hello,it's
test");<BR>&&DbAccess dbaccess = new
DbAccess();<BR>&&String <A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A> = "select * from xt_yh";<BR>&&ResultSet rs
= dbaccess.executeQuery(<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>);<BR>&&try<BR>&&{<BR>&&&while(rs.next()){<BR>&&&&System.out.print(rs.getString(1)+rs.getString(2)+rs.getString(3)+rs.getString(4)+rs.getString(5)+rs.getString(6));<BR>&&&&System.out.println();<BR>&&&}<BR>&&dbaccess.closeStmt();<BR>&&dbaccess.closeConn();<BR>&&}
<BR>&&catch (SQLException e)
<BR>&&{<BR>&&&// TODO 自动生成 catch
块<BR>&&&e.printStackTrace();<BR>&&}<BR>&}<BR>&}</P>
<P>&/*********DepEmplConfig.jsp************/</P>
<P>&&%@ page contentType="text/html; charset=gb2312" language="<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>" import="<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>.<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>.*,com.lcl.common.*" errorPage=""
%&<BR>&!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"<A
href="http://www.w3.org/TR/html4/loose.dtd">http://www.w3.org/TR/html4/loose.dtd</A>"&<BR>&html&<BR>&head&<BR>&meta
http-equiv="Content-Type" content="text/html;
charset=gb2312"&<BR>&title&无标题文档&/title&<BR>&HEAD&<BR>&script
type="text/<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>script"
src="../resources/xDataTree.js"&&/script&<BR>&link
type="text/css" rel="stylesheet" href="../resources/xtree.css"
/&<BR>&style type="text/css"&</P>
<P>body
{<BR>&background:&white;<BR>&color:&&black;<BR>}<BR>&/style&<BR>&TITLE&
New Document &/TITLE&<BR>&META NAME="Generator"
CONTENT="EditPlus"&<BR>&META NAME="Author"
CONTENT=""&<BR>&META NAME="Keywords" CONTENT=""&<BR>&META
NAME="Description" CONTENT=""&<BR>&/HEAD&<BR>&script
type="text/<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>script"&&
<BR>webFXTreeConfig.rootIcon&&=
"../resources/images/xp/folder.png";<BR>webFXTreeConfig.openRootIcon&=
"../resources/images/xp/openfolder.png";<BR>webFXTreeConfig.folderIcon&&=
"../resources/images/xp/folder.png";<BR>webFXTreeConfig.openFolderIcon&=
"../resources/images/xp/openfolder.png";<BR>webFXTreeConfig.fileIcon&&=
"../resources/images/xp/file.png";<BR>webFXTreeConfig.lMinusIcon&&=
"../resources/images/xp/Lminus.png";<BR>webFXTreeConfig.lPlusIcon&&=
"../resources/images/xp/Lplus.png";<BR>webFXTreeConfig.tMinusIcon&&=
"../resources/images/xp/Tminus.png";<BR>webFXTreeConfig.tPlusIcon&&=
"../resources/images/xp/Tplus.png";<BR>webFXTreeConfig.iIcon&&&=
"../resources/images/xp/I.png";<BR>webFXTreeConfig.lIcon&&&=
"../resources/images/xp/L.png";<BR>webFXTreeConfig.tIcon&&&=
"../resources/images/xp/T.png";<BR>webFXTreeConfig.blankIcon&&&&&&
= "../resources/images/blank.png";</P>
<P>var tree = new WebFXTree("单位人员基本情况","R0");<BR>var child;<BR>var
nodeToAddPerson;</P>
<P>function addDeptTreeNode(preNodeLevel,curNodeLevel,dispLabel,sKey,sTag)
{<BR>& if(curNodeLevel==1) {<BR>&&&& child =
tree.add(new WebFXTreeItem(dispLabel,sKey,sTag));<BR>& }<BR>&
else {<BR>&&& if(curNodeLevel==preNodeLevel)
{<BR>&&&&&&
if(child.parentNode)<BR>&&&&&&& child =
child.parentNode.add(new
WebFXTreeItem(dispLabel,sKey,sTag));<BR>&&&
}<BR>&&& if(curNodeLevel&preNodeLevel)
{<BR>&&&&&& child = child.add(new
WebFXTreeItem(dispLabel,sKey,sTag));<BR>&&&
}<BR>&&& if(curNodeLevel&preNodeLevel)
{<BR>&&&&&&&
for(i=0;i&preNodeLevel-curNodeLevel+1;i++)
<BR>&&&&&&&&&& child =
child.parentNode;<BR>&&&&&&& child =
child.add(new WebFXTreeItem(dispLabel,sKey,sTag));<BR>&&&
}<BR>& }<BR>& return child;<BR>}</P>
<P>function treeClick() {<BR>&if(tree.getSelected())
{<BR>&&&&
if(tree.getSelected().childNodes.length==0&&tree.getSelected().key!="R0")
<BR>&&&&&& cmdDelete.disabled =
false;<BR>&&&& else
<BR>&&&&&& cmdDelete.disabled = true;
<BR>&&&& if(tree.getSelected().key.substr(0,2)=="RZ")
{<BR>&&&&&& cmdAddDept.disabled =
true;<BR>&&&&&& cmdAddPeople.disabled =
true;<BR>&&&&&& var
strYhxh;<BR>&&&&&& strYhxh =
tree.getSelected().key.substr(2);<BR>&&&&&&
//window.open("../userAdm/editYh.do?yhxh="+strYhxh,"main");<BR>&&&&
}<BR>&&&& else
if(tree.getSelected().key.substr(0,2)=="RB")
{<BR>&&&&&& cmdAddDept.disabled =
false;<BR>&&&&&& cmdAddPeople.disabled =
false;<BR>&&&&&& var
strDwxh;<BR>&&&&&& strDwxh =
tree.getSelected().key.substr(2);<BR>&&&&&&
//window.open("../userAdm/editBm.do?dwxh="+strDwxh,"main");<BR>&&&&
}<BR>&&&& else
{<BR>&&&&&& cmdAddDept.disabled =
false;<BR>&&&&&& cmdAddPeople.disabled =
true;<BR>&&&&&&
//window.open("yhroot.jsp","main");<BR>&&&&
}<BR>&}<BR>}</P>
<P>function addPeople() {<BR>&&& var
strDwxh;<BR>&&& if(tree.getSelected()) {<BR>&& if
(tree.getSelected().key.substr(0,2)=="RB")
{<BR>&&&&&&& strDwxh =
tree.getSelected().key.substr(2);<BR>&&//window.open("../userAdm/addYh.do?dwxh="+strDwxh,"main");<BR>&&alert("addPeople");<BR>&&
}<BR>&&& }<BR>}</P>
<P>function addDept() {<BR>&&& var
strDwxh;<BR>&&& if(tree.getSelected()) {<BR>&& if
(tree.getSelected().key.substr(0,2)=="RB")
{<BR>&&&&&&& strDwfxh =
tree.getSelected().key.substr(2);<BR>&&//window.open("../userAdm/addBm.do?dwfxh="+strDwfxh,"main");<BR>&&
&alert("addDept");<BR>&&
}<BR>&&&&& else if(tree.getSelected().key=="R0")
{<BR>&&&&&&&
//window.open("../userAdm/addBm.do?dwfxh=0","main");<BR>&&&&&&&
alert("addDept");<BR>&&&&&
}<BR>&&& }<BR>}</P>
<P>function deleSelected() {<BR>&
if(!confirm("确认删除该节点吗?"))<BR>&&&&&
return;<BR>& if(tree.getSelected()) {<BR>&&&
if(tree.getSelected().key.substr(0,2)=="RB")
{<BR>&&&&&& var
strDwxh;<BR>&&&&&& strDwxh =
tree.getSelected().key.substr(2);<BR>&&&&&&
//window.open("../userAdm/delBm.do?dwxh="+strDwxh,"main");<BR>&&&&&&
alert("deleSelected");<BR>&&& }<BR>&&& else
if(tree.getSelected().key.substr(0,2)=='RZ')
{<BR>&&&&&& var
strYhxh,strYhbh;<BR>&&&&&& strYhxh =
tree.getSelected().key.substr(2);<BR>&&&&&&
strYhbh = tree.getSelected().tag;<BR>&&&&&&
//window.open("../userAdm/delYh.do?yhxh="+strYhxh+"&yhbh="+strYhbh,"main");<BR>&&&&&&
alert("deleSelected");<BR>&&& }<BR>& }<BR>}</P>
<P>function removeNode() {<BR>& if(tree.getSelected())
{<BR>&&& var node =
tree.getSelected();<BR>&&& node.remove();<BR>&
}<BR>}</P>
<P>function addPeopleNode(strParentKey,strKey,strText,strTag) {<BR>&
if(tree.getSelected()) {<BR>&&& var node =
tree.getSelected();<BR>&&& var
childNode;<BR>&&& //node.expand();<BR>&&&
childNode = node.add(new
WebFXTreeItem(strText,strKey,strTag,"","","../resources/images/people1.png"));<BR>&&&
node.expand(); //why I do so? I dont want to tell
you,hah!<BR>&&& childNode.focus();<BR>&&&
treeClick();<BR>& }<BR>}</P>
<P>function addDeptNode(strParentKey,strKey,strText,strTag) {<BR>&
if(tree.getSelected()) {<BR>&&& var node =
tree.getSelected();<BR>&&& var
childNode;<BR>&&& childNode = node.add(new
WebFXTreeItem(strText,strKey,strTag));<BR>&&&
node.expand();<BR>&&&
childNode.focus();<BR>&&& treeClick();<BR>& }<BR>}</P>
<P>function updateDeptNode(strTag,strText) {<BR>&
if(tree.getSelected()) {<BR>&&& var node =
tree.getSelected();<BR>&&& node.text =
strText;<BR>&&& node.tag& =
strTag;<BR>&&& node.focus();<BR>& }<BR>}</P>
<P>function updatePeopleNode(strTag,strText) {<BR>&
if(tree.getSelected()) {<BR>&&& var node =
tree.getSelected();<BR>&&& node.text =
strText;<BR>&&& node.tag& =
strTag;<BR>&&& node.focus();<BR>&
}<BR>}<BR>&/script&<BR>&%<BR>int dwxh;<BR>int dwfxh;<BR>int
yhxh;<BR>String dwbh = null;<BR>String dwmc = null;<BR>String yhmc =
null;<BR>String yhbh = null;<BR>int preLevel =1;<BR>int level =
1;<BR>DbAccess dbaccess = new DbAccess();<BR>String <A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A> = "select dwxh,dwbh,dwmc,dwfxh from xt_dw order by
dwbh";<BR>ResultSet rs = dbaccess.executeQuery(<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>);<BR>try<BR>{<BR>&while(rs.next())<BR>&{<BR>&&&&&&&
dwxh = rs.getInt(1);<BR>&&&&&&& dwbh =
rs.getString(2);<BR>&&&&&&& dwmc =
rs.getString(3);<BR>&&&&&&& dwfxh =
rs.getInt(4);<BR>//通过单位编号计算level<BR>&&String last =
dwbh.substring(9,10);<BR>&&int i =
9;<BR>&&while(last.equals("0") &&
i&0){<BR>&&&i--;<BR>&&&last =
dwbh.substring(i,i+1);<BR>&&<BR>&&}<BR>&&<BR>&&if(i==0
|| i==1) level =1;<BR>&&if(i==2 || i==3) level
=2;<BR>&&if(i==4 || i==5) level =3;<BR>&&if(i==6 ||
i==7) level =4;<BR>&&if(i==8 || i==9) level
=5;<BR>//<BR>&&%&<BR>&&&&&&&&&&
&script type="text/<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>script"&& <BR>&&&&
nodeToAddPerson =
addDeptTreeNode(&%=preLevel%&,&%=level%&,"&%=dwmc%&","RB&%=dwxh%&","&%=dwbh%&");<BR>&&&&&&&
&/script&&&<BR>&&<BR>&&&%<BR>&&preLevel
= level;<BR>&&String sub<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A> = "select yhxh,yhmc,yhbh from xt_yh where dwxh =
"+Integer.toString(dwxh);<BR>&&ResultSet subRs =
dbaccess.executeQuery(sub<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>);<BR>&&&&&&
while(subRs.next())
{<BR>&&&&&&&&&&&&&
yhxh =
subRs.getInt(1);<BR>&&&&&&&&&&&&&
yhmc =
subRs.getString(2);<BR>&&&&&&&&&&&&&
yhbh = subRs.getString(3);
<BR>&&%&<BR>&&&&&&&&&&&&
&script type="text/<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>script"&& <BR>&&&&
nodeToAddPerson.add(new
WebFXTreeItem("&%=yhmc%&","RZ&%=yhxh%&","&%=yhbh%&","","","../resources/images/people1.png"));<BR>&&&&&&&
&/script&<BR>&&&&
&%<BR>&&}<BR>&&<BR>&}<BR>&dbaccess.closeStmt();<BR>&dbaccess.closeConn();<BR>}<BR>catch(Exception
e)<BR>{</P>
<P>}<BR>%&</P>
<P></P>
<P>&base target="_self"&<BR>&META HTTP-EQUIV="PRAGMA"
CONTENT="NO-CACHE"&<BR>&/head&<BR>&body&<BR>&table
border="0" width="100%" cellspacing="0" cellpadding="0"&<BR>&
&tr&<BR>&&& &td width="273"
colspan="2"&<BR>&&&&&& &font face="宋体"
size="3"&&&&&
<BR>&&&&&&
&/font&<BR>&&& &/td&<BR>&
&/tr&<BR>& &tr&<BR>&&& &th width="33%"
align="center" nowrap&<BR>&&&&& &p
align="center"&<BR>&&&&& &INPUT
id=cmdAddDept name="AddDept" type=button value="增加部门" onclick="addDept()"
style="FONT-FAMILY: 楷体_GB2312; FONT-SIZE: 12pt; FONT-WEIGHT: bold; HEIGHT:
24px; WIDTH: 80px" &<BR>&&&&&
&/p&<BR>&&& &/th&<BR>&&& &th
width="33%" align="center" nowrap&<BR>&&&&&
&p align="center"&<BR>&&&&& &INPUT
id=cmdAddPeople name="AddPeople" type=button value="增加用户"
onclick="addPeople()" style="FONT-FAMILY: 楷体_GB2312; FONT-SIZE: 12pt;
FONT-WEIGHT: bold; HEIGHT: 24px; WIDTH: 80px"
&<BR>&&&&& &/p&<BR>&&&
&/th&<BR>&&& &th width="33%" align="center"
nowrap&<BR>&&&&& &p
align="center"&<BR>&&&&& &INPUT
id=cmdDelete name="Delete" type=button value=" 删除 "
onclick="deleSelected()" style="FONT-FAMILY: 楷体_GB2312; FONT-SIZE: 12pt;
FONT-WEIGHT: bold; HEIGHT: 24px; WIDTH: 80px"
disabled&<BR>&&&&&
&/p&<BR>&&& &/th&<BR>&
&/tr&<BR>& &tr&<BR>&&& &td width="273"
height="8"&
colspan="2"&&nbsp;<BR>&&&&&
<BR>&&& &/td&<BR>&
&/tr&<BR>&/table&<BR>&/body&<BR>&div
onclick="treeClick()"&<BR>&script type="text/<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>script"&&
<BR>&document.write(tree);<BR>&/script&<BR>&/div&<BR>&/HTML&</P>
<P>//其中jsp页面上的几个<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>script函数为同事牛人彭越所写,我没改动,在此说明.<BR></P></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=p2 align=right bgColor=#fdf9e7 height=22><A
href="http://duduwolf.360doc.com/showWeb/0/1/31209.aspx">上一篇</A>&&&&<A
href="http://duduwolf.360doc.com/showWeb/0/1/30257.aspx">下一篇</A>&&&&(<A
href="http://duduwolf.360doc.com/UserHome/677.aspx">smoking_boy</A>的分类目录[<A
href="http://duduwolf.360doc.com/UserArt.aspx?UserID=677&CategoryID=1&GroupID=-1">我的图书馆</A>]中共136篇)&&
</TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=p2 bgColor=#fffcf4>发表评论</TD></TR>
<TR>
<TD align=middle height=2></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=1 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=top></TD>
<TD vAlign=top>
<FORM id=showWeb name=showWeb
action=30580.aspx?Cream=0&CategoryID=0&ArticleID=30580
method=post><INPUT type=hidden
value=dDwtMTMzMjE3NjQ2Njt0PDtsPGk8MD47PjtsPHQ8QDA8cDxwPGw8RGF0YUtleXM7XyFJdGVtQ291bnQ7PjtsPGw8PjtpPDA+Oz4+Oz47Ozs7Ozs7Oz47Oz47Pj47PrMJmOXAYvkRKoedUaZNexdcdOy3
name=__VIEWSTATE>
<TABLE cellSpacing=0 cellPadding=0 width="90%" border=0>
<TBODY>
<TR>
<TD class=p2 align=middle colSpan=2>游客请<A
href="http://duduwolf.360doc.com/login.aspx?type=14&ArticleID=30580">登录</A>后再发表评论!
</TD></TR></TBODY></TABLE></FORM></TD></TR></TBODY></TABLE></BODY></HTML>
<!-- saved from url=(0049)http://duduwolf.360doc.com/showWeb/0/0/30580.aspx -->
<HTML><HEAD><TITLE>不用迭代算法而快速实现的jsp树结构</TITLE>
<META http-equiv=Content-Type content=text/html;charset=gb2312>
<META content=360doc name=classification>
<META content=不用迭代算法而快速实现的jsp树结构 name=keywords>
<META content=不用迭代算法而快速实现的jsp树结构 name=description>
<META content=www.360doc.com name=author>
<STYLE>.Title01 {
FONT-SIZE: 12px; COLOR: #004499; LINE-HEIGHT: 20px; FONT-FAMILY: arial, helvetica
}
.Title01 A {
COLOR: #0077cc; TEXT-DECORATION: none
}
.Title01 A:hover {
COLOR: #997722; TEXT-DECORATION: none
}
.Title01 A:visited {
TEXT-DECORATION: none
}
.TitleDate {
FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #999999; FONT-FAMILY: arial, helvetica
}
.TitleContent {
FONT-SIZE: 12px; COLOR: #000000; LINE-HEIGHT: 20px; FONT-FAMILY: arial, helvetica
}
.TitleContent A {
COLOR: #0077cc; TEXT-DECORATION: none
}
.TitleContent A:hover {
COLOR: #997722; TEXT-DECORATION: none
}
.TitleContent A:visited {
TEXT-DECORATION: none
}
.p2 {
FONT-SIZE: 12px; LINE-HEIGHT: 24px
}
.p2 A:visited {
COLOR: #261cdc
}
.p3 {
FONT-FAMILY: arial
}
.p3 {
FONT-SIZE: 9pt; LINE-HEIGHT: 18px
}
</STYLE>
<SCRIPT language=javascript>
<!--
//-->
</SCRIPT>
<META content="MSHTML 6.00.2800.1226" name=GENERATOR></HEAD>
<BODY text=#000000 bottomMargin=0 vLink=#261cdc link=#261cdc bgColor=#ffffff
topMargin=1>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD><A href="http://duduwolf.360doc.com/index.aspx" target=_blank><IMG
src="不用迭代算法而快速实现的jsp树结构.files/iDocumentBanner.gif" border=0></A></TD>
<TD align=middle><A href="http://duduwolf.360doc.com/index.aspx"
target=_blank><IMG src="不用迭代算法而快速实现的jsp树结构.files/360docAd.gif"
border=0></A></TD></TR>
<TR>
<TD align=middle height=3></TD></TR>
<TR>
<TD colSpan=2>
<TABLE height=22 cellSpacing=0 cellPadding=0 width="100%" border=0
valign="top">
<TBODY>
<TR bgColor=#fffcf4 height=22>
<TD class=p2>不用迭代算法而快速实现的jsp树结构(转载)&<FONT color=#6f6f6f
size=1>05.11.14 </FONT>&<FONT color=#6f6f6f>from </FONT><A
href="http://duduwolf.360doc.com/UserHome/677.aspx">smoking_boy</A> <NOBR><A
href="http://www.chinaitpower.com/A/2005-06-16/150031.html">来源</A> </NOBR>
</TD>
<TD class=p2 align=right width=120><A
href="http://duduwolf.360doc.com/showWeb/0/1/31209.aspx">上一篇</A>&&&&<A
href="http://duduwolf.360doc.com/showWeb/0/1/30257.aspx">下一篇</A>&&&&</TD></TR></TBODY></TABLE>
<TABLE height=22 cellSpacing=0 cellPadding=0 width="100%" border=0
valign="top">
<TBODY>
<TR bgColor=#fdf9e7 height=22>
<TD class=p2></TD>
<TD class=p2 align=right><FONT face=楷体_GB2312>这篇文章不错,<A
href="http://duduwolf.360doc.com/ReSaveMenu.aspx?ArticleID=30580">我也要收藏</A>&&&&</FONT>
</TD></TR></TBODY></TABLE></TD></TR>
<TR></TR></TBODY></TABLE>
<TABLE>
<TBODY>
<TR>
<TD>
<P>在web页面上实现树状结构,有点麻烦.<BR>在最近的一个MIS<A
href="http://www.chinaitpower.com/System/index.html"
target=_blank>系统</A>的开发中,我们项目组大量用到了树结构:比如人员的选择,单位的选择等待.<BR>这个MIS<A
href="http://www.chinaitpower.com/System/index.html"
target=_blank>系统</A>所用的<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>是oracle 9i.& oracle 9i 的<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>支持迭代查询.我们的树是由牛人彭越写的,不过<BR>也参照了<A
href="http://www.chinaitpower.com/Net/index.html"
target=_blank>网络</A>上比较著名的xtree(可以到此下载:http://webfx.eae.net/),他的树算法支持无限级的树结构,不过性能好像<BR>很慢.我持保留态度.<BR>他用到的关键技术就是这句话:<BR>String
<A href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A> = "select dwxh,dwbh,dwmc,dwfxh,level cc from xt_dw
connect by& prior dwxh = dwfxh start with dwfxh = 0";<BR>可是许多<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>不支持迭代查询,并且迭代查询速度真是不能忍受.有什么更好的办法呢.下面说说我的解决方案.</P>
<P>一:需求的提出<BR>1:客户需要一个关于部门人员的树结构,<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>为my<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>4.1<BR>2:<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>实现<BR>二:建表:<BR>1:<BR>用户信息表:<BR>各字段为:用户序号,用户编号,用户名称,单位序号,密码,用户登陆号<BR>create
table XT_YH<BR>(<BR>& YHXH& INT(9) NOT NULL auto_increment
PRIMARY KEY,<BR>& YHBH& VARCHAR(30),<BR>& YHMC&
VARCHAR(30),<BR>& DWXH& INT(9),<BR>& PWD&&
VARCHAR(20),<BR>& YHDLH VARCHAR(30)<BR>)<BR>--插入三条测试数据:<BR>--insert
into xt_yh(yhbh,yhmc,dwxh,pwd,yhdlh)
values('licl','李春雷',2,'password','licl')<BR>--insert into
xt_yh(yhbh,yhmc,dwxh,pwd,yhdlh)
values('fengx','冯欣',2,'password','fengx')<BR>--insert into
xt_yh(yhbh,yhmc,dwxh,pwd,yhdlh)
values('wangqx','王庆香',6,'password','wangqx')<BR>2:<BR>单位部门表<BR>各字段为:单位序号,单位编号,单位名称,单位父序号<BR>create
table XT_DW<BR>(<BR>& DWXH& int(9) NOT NULL auto_increment
PRIMARY KEY,<BR>& DWBH& VARCHAR(10),<BR>& DWMC&
VARCHAR(30),<BR>& DWFXH int(9)<BR>)<BR>--插入5条测试数据<BR>--insert into
xt_dw(dwbh,dwmc,dwfxh) values('0100000000','武汉科技局',0);<BR>--insert into
xt_dw(dwbh,dwmc,dwfxh) values('0101000000','人事处',1);<BR>--insert into
xt_dw(dwbh,dwmc,dwfxh) values('0102000000','后勤处',1);<BR>--insert into
xt_dw(dwbh,dwmc,dwfxh) values('0101010000','人事处son1',2);<BR>--insert into
xt_dw(dwbh,dwmc,dwfxh) values('0101020000','人事处son2',2);<BR>--insert into
xt_dw(dwbh,dwmc,dwfxh) values('0102010000','后勤处son1',3);</P>
<P>注意:<BR>为了实现快速的树结构实现,我需要充分利用单位编号DWBH,DWBH才有10位编码,其中,第一第二位表示一级单位,第三第四位表示二级单位,<BR>第五六位表示三级单位...那么10位编码就可以实现五级单位的树结构.<BR>比如:测试数据的树结构如下:<BR>&
1& 武汉科技局:<BR>&2& 人事处<BR>&&3&
人事处son1<BR>&&3& 人事处son2<BR>&2&
后勤处<BR>&&3后勤处son1</P>
<P>其实XT_DW表中的父序号是多余的.不过如果你要用迭代算法来实现,就是必须的<BR>才有10位编码,我只需要一句简单快速的<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>语句就可以实现树结构:<BR>String <A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A> = "select dwxh,dwbh,dwmc,dwfxh from xt_dw order by
dwbh"<BR>这句<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>在几乎所有的<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>平台都能执行,速度也快.<BR>下面贴出采用xtree,用10位编码而不是迭代算法实现的树:</P>
<P>/*******Constants.<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>**********/</P>
<P>package com.lcl.common;</P>
<P>public class Constants {<BR>&<BR>&public static final String
DBDRIVER = "com.my<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>.jdbc.Driver";&&&
//MYSQL驱动<BR>&<BR>&public static final String DBUrl="jdbc:my<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>://localhost/beauoa"; //<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>url<BR>&<BR>&public static final String
USERNAME="root";&&&&&&&&&&&&&&&&&&&&&&
//<A href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>用户名<BR>&<BR>&public static final String
PASSWORD="root";&&&& //<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>密码<BR>&<BR>&<BR>}</P>
<P><BR>/**********DbAccess.<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>****************/</P>
<P>package com.lcl.common;</P>
<P>import <A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>.<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>.*;<BR>import <A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>.lang.*;</P>
<P>/**<BR>&* @author 李春雷<BR>&*<BR>&* TODO
要更改此生成的类型注释的模板,请转至<BR>&* <A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>访问类<BR>&*/<BR>public class DbAccess<BR>{&
<BR>&String strDBDriver = Constants.DBDRIVER;<BR>&String
strDBUrl = Constants.DBUrl;<BR>&String username =
Constants.USERNAME;<BR>&String password =
Constants.PASSWORD;<BR>&private Connection conn =
null;<BR>&private Statement stmt = null;<BR>&ResultSet
rs=null;<BR>&//注册<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>驱动<A
href="http://www.chinaitpower.com/Dev/index.html"
target=_blank>程序</A><BR>&public DbAccess()<BR>&{&
<BR>&&try <BR>&&{&
<BR>&&&Class.forName(strDBDriver);<BR>&&}<BR>&&//异常处理<BR>&&catch(
<A href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>.lang.ClassNotFoundException
e)<BR>&&{<BR>&&&System.err.println("DbAccess():"+e.getMessage());<BR>&&}<BR>&}<BR>&//建立<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A>连接及定义数据查询<BR>&public ResultSet
executeQuery(String <A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>)<BR>&{<BR>&&rs=null;<BR>&&try<BR>&&{<BR>&&&conn=DriverManager.getConnection(strDBUrl,username,password);<BR>&&&stmt=conn.createStatement();<BR>&&&rs=stmt.executeQuery(<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>);<BR>&&}<BR>&&catch(SQLException
ex)<BR>&&{<BR>&&&System.err.println("ap.executeQuery:"+ex.getMessage());<BR>&&}<BR>&<BR>&&return
rs;<BR>&}<BR>&//定义数据操库作<BR>&public void
executeUpdate(String <A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>)<BR>&{<BR>&&stmt=null;<BR>&&rs=null;<BR>&&try<BR>&&{<BR>&&&conn=DriverManager.getConnection(strDBUrl,username,password);<BR>&&&stmt=conn.createStatement();<BR>&&&stmt.executeQuery(<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>);<BR>&&&stmt.close();<BR>&&&conn.close();<BR>&&}<BR>&&catch(SQLException
ex)<BR>&&{<BR>&&&System.err.println("ap.executeQuery:"+ex.getMessage());<BR>&&}<BR>&}<BR>&//关闭<A
href="http://www.chinaitpower.com/Dev/DataBase/index.html"
target=_blank>数据库</A><BR>&public void
closeStmt()<BR>&{<BR>&&try<BR>&&{<BR>&&&stmt.close();<BR>&&}<BR>&&catch(SQLException
e)<BR>&&{<BR>&&&e.printStackTrace();<BR>&&}<BR>&}<BR>&public
void
closeConn()<BR>&{<BR>&&try<BR>&&{<BR>&&&conn.close();<BR>&&}<BR>&&catch(SQLException
e)<BR>&&{<BR>&&&e.printStackTrace();<BR>&&}<BR>&}<BR>&public
static void main(String[]
args){<BR>&&System.out.println("hello,it's
test");<BR>&&DbAccess dbaccess = new
DbAccess();<BR>&&String <A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A> = "select * from xt_yh";<BR>&&ResultSet rs
= dbaccess.executeQuery(<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>);<BR>&&try<BR>&&{<BR>&&&while(rs.next()){<BR>&&&&System.out.print(rs.getString(1)+rs.getString(2)+rs.getString(3)+rs.getString(4)+rs.getString(5)+rs.getString(6));<BR>&&&&System.out.println();<BR>&&&}<BR>&&dbaccess.closeStmt();<BR>&&dbaccess.closeConn();<BR>&&}
<BR>&&catch (SQLException e)
<BR>&&{<BR>&&&// TODO 自动生成 catch
块<BR>&&&e.printStackTrace();<BR>&&}<BR>&}<BR>&}</P>
<P>&/*********DepEmplConfig.jsp************/</P>
<P>&&%@ page contentType="text/html; charset=gb2312" language="<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>" import="<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>.<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>.*,com.lcl.common.*" errorPage=""
%&<BR>&!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"<A
href="http://www.w3.org/TR/html4/loose.dtd">http://www.w3.org/TR/html4/loose.dtd</A>"&<BR>&html&<BR>&head&<BR>&meta
http-equiv="Content-Type" content="text/html;
charset=gb2312"&<BR>&title&无标题文档&/title&<BR>&HEAD&<BR>&script
type="text/<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>script"
src="../resources/xDataTree.js"&&/script&<BR>&link
type="text/css" rel="stylesheet" href="../resources/xtree.css"
/&<BR>&style type="text/css"&</P>
<P>body
{<BR>&background:&white;<BR>&color:&&black;<BR>}<BR>&/style&<BR>&TITLE&
New Document &/TITLE&<BR>&META NAME="Generator"
CONTENT="EditPlus"&<BR>&META NAME="Author"
CONTENT=""&<BR>&META NAME="Keywords" CONTENT=""&<BR>&META
NAME="Description" CONTENT=""&<BR>&/HEAD&<BR>&script
type="text/<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>script"&&
<BR>webFXTreeConfig.rootIcon&&=
"../resources/images/xp/folder.png";<BR>webFXTreeConfig.openRootIcon&=
"../resources/images/xp/openfolder.png";<BR>webFXTreeConfig.folderIcon&&=
"../resources/images/xp/folder.png";<BR>webFXTreeConfig.openFolderIcon&=
"../resources/images/xp/openfolder.png";<BR>webFXTreeConfig.fileIcon&&=
"../resources/images/xp/file.png";<BR>webFXTreeConfig.lMinusIcon&&=
"../resources/images/xp/Lminus.png";<BR>webFXTreeConfig.lPlusIcon&&=
"../resources/images/xp/Lplus.png";<BR>webFXTreeConfig.tMinusIcon&&=
"../resources/images/xp/Tminus.png";<BR>webFXTreeConfig.tPlusIcon&&=
"../resources/images/xp/Tplus.png";<BR>webFXTreeConfig.iIcon&&&=
"../resources/images/xp/I.png";<BR>webFXTreeConfig.lIcon&&&=
"../resources/images/xp/L.png";<BR>webFXTreeConfig.tIcon&&&=
"../resources/images/xp/T.png";<BR>webFXTreeConfig.blankIcon&&&&&&
= "../resources/images/blank.png";</P>
<P>var tree = new WebFXTree("单位人员基本情况","R0");<BR>var child;<BR>var
nodeToAddPerson;</P>
<P>function addDeptTreeNode(preNodeLevel,curNodeLevel,dispLabel,sKey,sTag)
{<BR>& if(curNodeLevel==1) {<BR>&&&& child =
tree.add(new WebFXTreeItem(dispLabel,sKey,sTag));<BR>& }<BR>&
else {<BR>&&& if(curNodeLevel==preNodeLevel)
{<BR>&&&&&&
if(child.parentNode)<BR>&&&&&&& child =
child.parentNode.add(new
WebFXTreeItem(dispLabel,sKey,sTag));<BR>&&&
}<BR>&&& if(curNodeLevel&preNodeLevel)
{<BR>&&&&&& child = child.add(new
WebFXTreeItem(dispLabel,sKey,sTag));<BR>&&&
}<BR>&&& if(curNodeLevel&preNodeLevel)
{<BR>&&&&&&&
for(i=0;i&preNodeLevel-curNodeLevel+1;i++)
<BR>&&&&&&&&&& child =
child.parentNode;<BR>&&&&&&& child =
child.add(new WebFXTreeItem(dispLabel,sKey,sTag));<BR>&&&
}<BR>& }<BR>& return child;<BR>}</P>
<P>function treeClick() {<BR>&if(tree.getSelected())
{<BR>&&&&
if(tree.getSelected().childNodes.length==0&&tree.getSelected().key!="R0")
<BR>&&&&&& cmdDelete.disabled =
false;<BR>&&&& else
<BR>&&&&&& cmdDelete.disabled = true;
<BR>&&&& if(tree.getSelected().key.substr(0,2)=="RZ")
{<BR>&&&&&& cmdAddDept.disabled =
true;<BR>&&&&&& cmdAddPeople.disabled =
true;<BR>&&&&&& var
strYhxh;<BR>&&&&&& strYhxh =
tree.getSelected().key.substr(2);<BR>&&&&&&
//window.open("../userAdm/editYh.do?yhxh="+strYhxh,"main");<BR>&&&&
}<BR>&&&& else
if(tree.getSelected().key.substr(0,2)=="RB")
{<BR>&&&&&& cmdAddDept.disabled =
false;<BR>&&&&&& cmdAddPeople.disabled =
false;<BR>&&&&&& var
strDwxh;<BR>&&&&&& strDwxh =
tree.getSelected().key.substr(2);<BR>&&&&&&
//window.open("../userAdm/editBm.do?dwxh="+strDwxh,"main");<BR>&&&&
}<BR>&&&& else
{<BR>&&&&&& cmdAddDept.disabled =
false;<BR>&&&&&& cmdAddPeople.disabled =
true;<BR>&&&&&&
//window.open("yhroot.jsp","main");<BR>&&&&
}<BR>&}<BR>}</P>
<P>function addPeople() {<BR>&&& var
strDwxh;<BR>&&& if(tree.getSelected()) {<BR>&& if
(tree.getSelected().key.substr(0,2)=="RB")
{<BR>&&&&&&& strDwxh =
tree.getSelected().key.substr(2);<BR>&&//window.open("../userAdm/addYh.do?dwxh="+strDwxh,"main");<BR>&&alert("addPeople");<BR>&&
}<BR>&&& }<BR>}</P>
<P>function addDept() {<BR>&&& var
strDwxh;<BR>&&& if(tree.getSelected()) {<BR>&& if
(tree.getSelected().key.substr(0,2)=="RB")
{<BR>&&&&&&& strDwfxh =
tree.getSelected().key.substr(2);<BR>&&//window.open("../userAdm/addBm.do?dwfxh="+strDwfxh,"main");<BR>&&
&alert("addDept");<BR>&&
}<BR>&&&&& else if(tree.getSelected().key=="R0")
{<BR>&&&&&&&
//window.open("../userAdm/addBm.do?dwfxh=0","main");<BR>&&&&&&&
alert("addDept");<BR>&&&&&
}<BR>&&& }<BR>}</P>
<P>function deleSelected() {<BR>&
if(!confirm("确认删除该节点吗?"))<BR>&&&&&
return;<BR>& if(tree.getSelected()) {<BR>&&&
if(tree.getSelected().key.substr(0,2)=="RB")
{<BR>&&&&&& var
strDwxh;<BR>&&&&&& strDwxh =
tree.getSelected().key.substr(2);<BR>&&&&&&
//window.open("../userAdm/delBm.do?dwxh="+strDwxh,"main");<BR>&&&&&&
alert("deleSelected");<BR>&&& }<BR>&&& else
if(tree.getSelected().key.substr(0,2)=='RZ')
{<BR>&&&&&& var
strYhxh,strYhbh;<BR>&&&&&& strYhxh =
tree.getSelected().key.substr(2);<BR>&&&&&&
strYhbh = tree.getSelected().tag;<BR>&&&&&&
//window.open("../userAdm/delYh.do?yhxh="+strYhxh+"&yhbh="+strYhbh,"main");<BR>&&&&&&
alert("deleSelected");<BR>&&& }<BR>& }<BR>}</P>
<P>function removeNode() {<BR>& if(tree.getSelected())
{<BR>&&& var node =
tree.getSelected();<BR>&&& node.remove();<BR>&
}<BR>}</P>
<P>function addPeopleNode(strParentKey,strKey,strText,strTag) {<BR>&
if(tree.getSelected()) {<BR>&&& var node =
tree.getSelected();<BR>&&& var
childNode;<BR>&&& //node.expand();<BR>&&&
childNode = node.add(new
WebFXTreeItem(strText,strKey,strTag,"","","../resources/images/people1.png"));<BR>&&&
node.expand(); //why I do so? I dont want to tell
you,hah!<BR>&&& childNode.focus();<BR>&&&
treeClick();<BR>& }<BR>}</P>
<P>function addDeptNode(strParentKey,strKey,strText,strTag) {<BR>&
if(tree.getSelected()) {<BR>&&& var node =
tree.getSelected();<BR>&&& var
childNode;<BR>&&& childNode = node.add(new
WebFXTreeItem(strText,strKey,strTag));<BR>&&&
node.expand();<BR>&&&
childNode.focus();<BR>&&& treeClick();<BR>& }<BR>}</P>
<P>function updateDeptNode(strTag,strText) {<BR>&
if(tree.getSelected()) {<BR>&&& var node =
tree.getSelected();<BR>&&& node.text =
strText;<BR>&&& node.tag& =
strTag;<BR>&&& node.focus();<BR>& }<BR>}</P>
<P>function updatePeopleNode(strTag,strText) {<BR>&
if(tree.getSelected()) {<BR>&&& var node =
tree.getSelected();<BR>&&& node.text =
strText;<BR>&&& node.tag& =
strTag;<BR>&&& node.focus();<BR>&
}<BR>}<BR>&/script&<BR>&%<BR>int dwxh;<BR>int dwfxh;<BR>int
yhxh;<BR>String dwbh = null;<BR>String dwmc = null;<BR>String yhmc =
null;<BR>String yhbh = null;<BR>int preLevel =1;<BR>int level =
1;<BR>DbAccess dbaccess = new DbAccess();<BR>String <A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A> = "select dwxh,dwbh,dwmc,dwfxh from xt_dw order by
dwbh";<BR>ResultSet rs = dbaccess.executeQuery(<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>);<BR>try<BR>{<BR>&while(rs.next())<BR>&{<BR>&&&&&&&
dwxh = rs.getInt(1);<BR>&&&&&&& dwbh =
rs.getString(2);<BR>&&&&&&& dwmc =
rs.getString(3);<BR>&&&&&&& dwfxh =
rs.getInt(4);<BR>//通过单位编号计算level<BR>&&String last =
dwbh.substring(9,10);<BR>&&int i =
9;<BR>&&while(last.equals("0") &&
i&0){<BR>&&&i--;<BR>&&&last =
dwbh.substring(i,i+1);<BR>&&<BR>&&}<BR>&&<BR>&&if(i==0
|| i==1) level =1;<BR>&&if(i==2 || i==3) level
=2;<BR>&&if(i==4 || i==5) level =3;<BR>&&if(i==6 ||
i==7) level =4;<BR>&&if(i==8 || i==9) level
=5;<BR>//<BR>&&%&<BR>&&&&&&&&&&
&script type="text/<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>script"&& <BR>&&&&
nodeToAddPerson =
addDeptTreeNode(&%=preLevel%&,&%=level%&,"&%=dwmc%&","RB&%=dwxh%&","&%=dwbh%&");<BR>&&&&&&&
&/script&&&<BR>&&<BR>&&&%<BR>&&preLevel
= level;<BR>&&String sub<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A> = "select yhxh,yhmc,yhbh from xt_yh where dwxh =
"+Integer.toString(dwxh);<BR>&&ResultSet subRs =
dbaccess.executeQuery(sub<A
href="http://www.chinaitpower.com/Dev/DataBase/MsSql/index.html"
target=_blank>sql</A>);<BR>&&&&&&
while(subRs.next())
{<BR>&&&&&&&&&&&&&
yhxh =
subRs.getInt(1);<BR>&&&&&&&&&&&&&
yhmc =
subRs.getString(2);<BR>&&&&&&&&&&&&&
yhbh = subRs.getString(3);
<BR>&&%&<BR>&&&&&&&&&&&&
&script type="text/<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>script"&& <BR>&&&&
nodeToAddPerson.add(new
WebFXTreeItem("&%=yhmc%&","RZ&%=yhxh%&","&%=yhbh%&","","","../resources/images/people1.png"));<BR>&&&&&&&
&/script&<BR>&&&&
&%<BR>&&}<BR>&&<BR>&}<BR>&dbaccess.closeStmt();<BR>&dbaccess.closeConn();<BR>}<BR>catch(Exception
e)<BR>{</P>
<P>}<BR>%&</P>
<P></P>
<P>&base target="_self"&<BR>&META HTTP-EQUIV="PRAGMA"
CONTENT="NO-CACHE"&<BR>&/head&<BR>&body&<BR>&table
border="0" width="100%" cellspacing="0" cellpadding="0"&<BR>&
&tr&<BR>&&& &td width="273"
colspan="2"&<BR>&&&&&& &font face="宋体"
size="3"&&&&&
<BR>&&&&&&
&/font&<BR>&&& &/td&<BR>&
&/tr&<BR>& &tr&<BR>&&& &th width="33%"
align="center" nowrap&<BR>&&&&& &p
align="center"&<BR>&&&&& &INPUT
id=cmdAddDept name="AddDept" type=button value="增加部门" onclick="addDept()"
style="FONT-FAMILY: 楷体_GB2312; FONT-SIZE: 12pt; FONT-WEIGHT: bold; HEIGHT:
24px; WIDTH: 80px" &<BR>&&&&&
&/p&<BR>&&& &/th&<BR>&&& &th
width="33%" align="center" nowrap&<BR>&&&&&
&p align="center"&<BR>&&&&& &INPUT
id=cmdAddPeople name="AddPeople" type=button value="增加用户"
onclick="addPeople()" style="FONT-FAMILY: 楷体_GB2312; FONT-SIZE: 12pt;
FONT-WEIGHT: bold; HEIGHT: 24px; WIDTH: 80px"
&<BR>&&&&& &/p&<BR>&&&
&/th&<BR>&&& &th width="33%" align="center"
nowrap&<BR>&&&&& &p
align="center"&<BR>&&&&& &INPUT
id=cmdDelete name="Delete" type=button value=" 删除 "
onclick="deleSelected()" style="FONT-FAMILY: 楷体_GB2312; FONT-SIZE: 12pt;
FONT-WEIGHT: bold; HEIGHT: 24px; WIDTH: 80px"
disabled&<BR>&&&&&
&/p&<BR>&&& &/th&<BR>&
&/tr&<BR>& &tr&<BR>&&& &td width="273"
height="8"&
colspan="2"&&nbsp;<BR>&&&&&
<BR>&&& &/td&<BR>&
&/tr&<BR>&/table&<BR>&/body&<BR>&div
onclick="treeClick()"&<BR>&script type="text/<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>script"&&
<BR>&document.write(tree);<BR>&/script&<BR>&/div&<BR>&/HTML&</P>
<P>//其中jsp页面上的几个<A
href="http://www.chinaitpower.com/Dev/Programme/Java/index.html"
target=_blank>java</A>script函数为同事牛人彭越所写,我没改动,在此说明.<BR></P></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=p2 align=right bgColor=#fdf9e7 height=22><A
href="http://duduwolf.360doc.com/showWeb/0/1/31209.aspx">上一篇</A>&&&&<A
href="http://duduwolf.360doc.com/showWeb/0/1/30257.aspx">下一篇</A>&&&&(<A
href="http://duduwolf.360doc.com/UserHome/677.aspx">smoking_boy</A>的分类目录[<A
href="http://duduwolf.360doc.com/UserArt.aspx?UserID=677&CategoryID=1&GroupID=-1">我的图书馆</A>]中共136篇)&&
</TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=p2 bgColor=#fffcf4>发表评论</TD></TR>
<TR>
<TD align=middle height=2></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=1 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=top></TD>
<TD vAlign=top>
<FORM id=showWeb name=showWeb
action=30580.aspx?Cream=0&CategoryID=0&ArticleID=30580
method=post><INPUT type=hidden
value=dDwtMTMzMjE3NjQ2Njt0PDtsPGk8MD47PjtsPHQ8QDA8cDxwPGw8RGF0YUtleXM7XyFJdGVtQ291bnQ7PjtsPGw8PjtpPDA+Oz4+Oz47Ozs7Ozs7Oz47Oz47Pj47PrMJmOXAYvkRKoedUaZNexdcdOy3
name=__VIEWSTATE>
<TABLE cellSpacing=0 cellPadding=0 width="90%" border=0>
<TBODY>
<TR>
<TD class=p2 align=middle colSpan=2>游客请<A
href="http://duduwolf.360doc.com/login.aspx?type=14&ArticleID=30580">登录</A>后再发表评论!
</TD></TR></TBODY></TABLE></FORM></TD></TR></TBODY></TABLE></BODY></HTML>
评论
2 楼
ttxiangyou
2008-10-14
呵呵,这个是乎有点乱呢?可以发到我邮箱吗?
zou_wei_forever@yahoo.com.cn
zou_wei_forever@yahoo.com.cn
1 楼
wangjian3q
2008-02-25
xDataTree.js 给我一份呢??谢谢您了
wangjian3q@163.com
wangjian3q@163.com
相关推荐
本文将深入探讨“JSP自定义标签”如何实现无限级树结构,并支持节点图标自定义,以及其背后的原理和技术要点。 首先,我们要理解什么是自定义标签。在JSP中,自定义标签是开发者为了简化页面逻辑、提高代码复用性而...
但基于标题和描述,我们可以假设这个项目涉及的关键技术包括:JSP、数据结构(如树)、分类目录管理、以及可能的排序算法。 【文件名称列表】 只有一个文件名"sortTree",这可能是项目的主要源代码文件,或者是一个...
迭代器模式用于顺序访问集合对象的元素,而递归则用于处理层级关系,如遍历树结构。 7. **数据结构**:为了在内存中有效地表示目录树,可能需要使用链表、树或者其他数据结构。例如,可以使用一个对象来表示每个...
4. **无限级分类算法**:有多种算法可以实现无限级分类目录树,如预排序遍历树(PreOrder Traversal Tree)、后序遍历(PostOrder Traversal)等。通常使用递归方式实现,遍历所有节点并根据父ID判断子节点。 5. **...
【标题】:“JSP无限级分类目录树_sorttree”是一个基于Java开发的Web应用程序,用于实现网站或系统中的无限层级分类展示。这个压缩包中包含了使用JSP(Java Server Pages)技术来构建一个动态的、可扩展的分类目录...
- **不稳定**:小的训练数据变动可能导致树结构大变。 - **剪枝**:为了防止过拟合,通常需要进行剪枝操作,但这可能引入新的问题,如欠拟合。 5. **dtree的变种与优化** - **CART(Classification and ...
JAVA的面向对象特性使得代码结构清晰,易于维护,这对于需要长期运行并不断迭代更新的HRM系统来说尤为重要。 1. **系统架构设计**:JAVA的多层架构设计(如三层架构:表现层、业务逻辑层、数据访问层)可以有效地...
文档可能涵盖了各种排序算法(如冒泡、快速、归并排序)和常用数据结构(如栈、队列、链表、树、图)的原理和实现。 10. **三歪教你学Mybatis.docx**:Mybatis是一个轻量级的持久层框架,简化了数据库操作。文档...
抽象并不打算了解全部问题,而只是选择其中的一部分,暂时不用部分细节。抽象包括两个方面,一是过程抽象,二是数据抽象。 2.继承: 继承是一种联结类的层次模型,并且允许和鼓励类的重用,它提供了一种明确...
组合(Composite)模式将对象组织成树形结构,可以表示部分-整体的关系。 行为型模式则关注对象之间的职责分配和通信。策略(Strategy)模式定义了一族算法,并将每个算法封装起来,使它们可以互相替换;观察者...
6. **数据结构和算法**:合理的数据结构(如队列、栈、树)和算法(如排序、搜索)能优化任务分配、设备状态更新等操作。 7. **异常处理**:良好的异常处理机制对于任何软件系统都是至关重要的,Java提供了丰富的...
在数据结构方面,实验可能包含数组、链表、栈、队列、树等基本数据结构的实现。这些是解决复杂问题的关键,比如搜索和排序算法。你可能会看到如快速排序、归并排序、二分查找等经典算法的Java实现。 函数和方法是...
1. **数据结构**:研究数据结构实际上涵盖了数据的逻辑结构(如数组、链表、树、图等)、存储结构(如顺序存储、链式存储、索引存储等)以及在这些结构上的运算实现。数据结构的选择直接影响到算法的效率和程序的...
- 树结构:二叉树、平衡树(AVL、红黑树)的操作。 - 链表、栈、队列等数据结构的理解和实现。 这些知识点只是Java面试中可能涉及的一部分,实际面试时,面试官可能会根据候选人的经验和项目经历来深入提问。因此...
本试卷主要涵盖了Java语言的基础知识,包括数据结构、算法、Java语法、多线程、JSP、面向对象特性、序列化、字符串处理、关键字用法以及数据库查询等内容。下面将对这些知识点进行详细说明: 1. **线性表与链表**:...
- **DOM** 是一种树形结构的XML解析方式,它可以将XML文档加载到内存中并进行操作。 - **SAX** 是一种基于事件驱动的XML解析方式,适用于大型XML文档的解析。 - **DOM适用于** 需要随机访问XML文档的情况,而SAX...
- **DOM (Document Object Model)**:将 XML 文档视为一个树形结构,允许程序遍历和修改文档。 - **SAX (Simple API for XML)**:是一种基于事件驱动的解析方式,适用于大型文档。 - **SAX 事件**:解析过程中会...
- **结构化**:采用树形结构组织数据。 - **自描述性**:数据包含自身描述信息,易于理解和解析。 - **开放标准**:基于 W3C 标准,兼容性好。 - **SAX (Simple API for XML) 和 DOM (Document Object Model)** ...
12. **数据结构与算法**:数组、链表、栈、队列、树、图等基本数据结构,以及排序算法(快速排序、归并排序、冒泡排序等)和查找算法(二分查找、哈希查找)。 13. **网络编程**:TCP和UDP协议,套接字编程,理解...