本文目录一览:
jsp 和 html 怎么实现树型目录结构
%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%
%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
html
head
base href="%=basePath%"
title制作简单的树形菜单/title
meta http-equiv="pragma" content="no-cache"
meta http-equiv="cache-control" content="no-cache"
meta http-equiv="expires" content="0"
meta http-equiv="keywords" content="keyword1,keyword2,keyword3"
meta http-equiv="description" content="This is my page"
!--
link rel="stylesheet" type="text/css" href="styles.css"
--
style type="text/css"
body{font-size:13px;
line-height:20px;
}
a{font-size: 13px;
color:blue;
text-decoration: none;
}
a:hover{font-size:13px;
color:red;
}
.no_circle{list-style-type:none; /*设置列表项标志的类型为无*/
display:none;
}
/style
script type="text/javascript"
function show(){
if(document.getElementById("a").style.display=='block'){
document.getElementById("a").style.display='none'; //触动的ul如果处于显示状态,即隐藏
}
else{
document.getElementById("a").style.display='block'; //触动的ul如果处于隐藏状态,即显示
}
}
/script
/head
body
b树形菜单:/b
ula href="javascript:onclick=show() "百度/a/ul
ul id="a" class="no_circle"
li新闻/li
li网页/li
li图片/li
li贴吧/li
li知道/li
/ul
/body
/html
jsp目录树
不大明白你什么意思,是在Tomcat中显示网站目录结构?那么就在Tomcat的conf文件夹下找到web.xml文件,然后找到
servlet
servlet-namedefault/servlet-name
servlet-classorg.apache.catalina.servlets.DefaultServlet/servlet-class
init-param
param-namedebug/param-name
param-value0/param-value
/init-param
init-param
param-namelistings/param-name
param-valuefalse/param-value
/init-param
load-on-startup1/load-on-startup
/servlet
把 param-namelistings/param-name的下一行改为
param-valuetrue/param-value就可以了
用jsp 怎么设计 树形目录啊
const
maxn=50;
maxm=1024;
var
block: array[1..maxn]of longint;
sumblock: array[0..maxm]of longint;
box: array[1..maxn]of longint;
sumbox: array[0..maxn]of longint;
use: array[1..maxm+1]of boolean;
n ,m ,mid ,sum ,ans: longint;
ok: boolean;
procedure qs(l ,r: longint);
var
i ,j ,x ,t: longint;
begin
i:=l;j:=r;x:=block[(l+r) shr 1];
repeat
while block[i]x do inc(i);
while block[j]x do dec(j);
if i=j then begin
t:=block[i];block[i]:=block[j];block[j]:=t;
inc(i);dec(j);
end;
until ij;
if ir then qs(i,r);
if lj then qs(l,j);
end;
procedure init;
var
i: longint;
begin
readln(n);
fillchar(box,sizeof(box),0);
fillchar(sumbox,sizeof(sumbox),0);
for i:= 1 to n do begin
readln(box[i]);
sumbox[i]:=sumbox[i-1]+box[i];
end;
readln(m);
fillchar(block,sizeof(block),0);
fillchar(sumblock,sizeof(sumblock),0);
for i:= 1 to m do
readln(block[i]);
qs(1,m);
for i:= 1 to m do
sumblock[i]:=sumblock[i-1]+block[i];
end;
procedure find(now ,num ,V: longint);
var
j: longint;
begin
if now=mid+1 then begin
ok:=true;
exit;
end;
if sumbox[n]-sumbox[num]+Vsum then
exit;
for j:= mid downto 1 do begin
if use[j] then begin
if (use[j+1])and(block[j]=block[j+1]) then
continue;
if V=block[j] then begin
dec(sum,block[j]);
use[j]:=false;
find(now+1,num,V-block[j]);
if ok then exit;
inc(sum,block[j]);
use[j]:=true;
end;
end;
end;
if numn then
find(now,num+1,box[num+1]);
end;
procedure main;
var
l ,r: longint;
begin
l:=1;r:=m;ans:=0;
repeat
mid:=(l+r) shr 1;
ok:=false;
fillchar(use,sizeof(use),true);
use[mid+1]:=false;
sum:=sumblock[mid];
find(1,1,box[1]);
if ok then begin
l:=mid+1;
ans:=mid;
end
else
r:=mid;
until (lr)or(l=mid);
end;
procedure ou;
begin
writeln(ans);
end;
begin
init;
main;
ou;
end.
JSP网页中中那种目录树是怎么实现的?
用dtree很方便,我最近也是做这种目录树
JS创建
var tree = new dTree('tree');
tree.add(10,0,'空间信息管理','goto(10)','','_c');
tree.add(11,10,'翠苑1区','goto(2)','单击查看该群组的信息','k');
tree.add(12,10,'翠苑2区','goto(2)','单击查看该群组的信息','FRAME_LIST');
tree.add(13,12,'第1栋','goto(3)','单击查看该群组的信息','FRAME_LIST');
tree.add(19,13,'第1单元','goto(3)','单击查看该群组的信息','FRAME_LIST');
tree.add(14,19,'第1层','goto(3)','单击查看该群组的信息','FRAME_LIST');
tree.add(15,14,'1号房','goto(1)','单击查看该群组的信息','FRAME_LIST');
tree.add(17,11,'第1栋','goto(3)','单击查看该群组的信息','FRAME_LIST');
tree.add(18,11,'第2栋','goto(3)','单击查看该群组的信息','FRAME_LIST');
tree.add(20,17,'第1单元','goto(3)','单击查看该群组的信息','FRAME_LIST');
tree.add(21,17,'第2单元','goto(3)','单击查看该群组的信息','FRAME_LIST');
tree.add(22,18,'第1单元','goto(3)','单击查看该群组的信息','FRAME_LIST');
tree.add(23,18,'第2单元','goto(3)','单击查看该群组的信息','FRAME_LIST');
tree.add(16,10,'嘉绿名苑','goto(2)','单击查看该群组的信息','FRAME_LIST');
然后在需要的位置这样调用script type="text/javascript"document.write(tree);/script
用jsp做树形目录怎么做
我刚刚做了这样一个东西,支持不定级的树。首先读取数据,之后在内存中生成树的结构,再用HTML形式(如果要实现用点击展开或收回的效果,加点JavaScript)表示出来,即可。