本文目錄一覽:
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)表示出來,即可。
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-hk/n/305284.html