JSP 动态树的实现(5)


<%@ page language="java" import="java.util.*" contentType="text/html; charset=gb2312"%>
<%@ page import="com.sx.mas.beans.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<LINK href="https://www.jb51.net/css/tree.css" href="https://www.jb51.net/css/tree.css" type=text/css rel=stylesheet>
<LINK href="https://www.jb51.net/css/css.css" href="https://www.jb51.net/css/css.css" rel=stylesheet>
<SCRIPT src="https://www.jb51.net/js/tree.js" src="https://www.jb51.net/js/tree.js" type=text/javascript></SCRIPT>
<title>My JSP 'index.jsp' starting page</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 type="text/css" href="https://www.jb51.net/styles.css" href="https://www.jb51.net/styles.css">
-->
</head>
<body onresize="return true;" leftMargin=1 topMargin=1>
<table>
<tr>
<td valign="top">
<TABLE class=table_left_menu cellSpacing=0 cellPadding=0
background=images/tree_bg.gif border=0>
<TBODY>
<TR>
<TD>
<DIV align=center><IMG height=24 src="https://www.jb51.net/images/tree_button.gif" src="https://www.jb51.net/images/tree_button.gif"
width=147 useMap=#Map border=0>
<MAP id=Map name=Map>
<AREA shape="RECT" shape="RECT" coords="16,3,69,15" coords="16,3,69,15" href="javascript:%20d.openAll()" href="javascript:%20d.openAll()">
<AREA shape="RECT" shape="RECT" coords="72,3,131,15" coords="72,3,131,15" href="javascript:%20d.closeAll()" href="javascript:%20d.closeAll()">
</MAP>
</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
<SCRIPT type=text/javascript>
d = new tree('d','../');
<%
TreeDAO treedao = new TreeDAO();
Vector vec =treedao.getTree();
Iterator iterator = vec.iterator();
while(iterator.hasNext()){
TreeNode treenode = (TreeNode)iterator.next();
if(treenode.getIsleaf()==0){
%>
d.add(<%=treenode.getTid()%>,<%=treenode.getPid()%>,'<%=treenode.getTname()%>')
<%}else{%>
d.add(<%=treenode.getTid()%>,<%=treenode.getPid()%>,'<%=treenode.getTname()%>',parent.getUrlByCatalogId('<%=treenode.getTid()%>'),null,'list');
<%}}%>
document.write(d);
</SCRIPT>
</td>
</tr>
</table>
</body>
</html>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=gb2312"%>
<%@ page import="com.sx.mas.beans.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<LINK href="https://www.jb51.net/css/tree.css" href="https://www.jb51.net/css/tree.css" type=text/css rel=stylesheet>
<LINK href="https://www.jb51.net/css/css.css" href="https://www.jb51.net/css/css.css" rel=stylesheet>
<SCRIPT src="https://www.jb51.net/js/tree.js" src="https://www.jb51.net/js/tree.js" type=text/javascript></SCRIPT>
<title>My JSP 'index.jsp' starting page</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 type="text/css" href="https://www.jb51.net/styles.css" href="https://www.jb51.net/styles.css">
    -->
</head>
<body onresize="return true;" leftMargin=1 topMargin=1>
    <table>
        <tr>
            <td valign="top">
<TABLE class=table_left_menu cellSpacing=0 cellPadding=0
background=images/tree_bg.gif border=0>
<TBODY>
<TR>
<TD>
<DIV align=center><IMG height=24 src="https://www.jb51.net/images/tree_button.gif" src="https://www.jb51.net/images/tree_button.gif"
width=147 useMap=#Map border=0>
<MAP id=Map name=Map>
<AREA shape="RECT" shape="RECT" coords="16,3,69,15" coords="16,3,69,15" href="javascript:%20d.openAll()" href="javascript:%20d.openAll()">
<AREA shape="RECT" shape="RECT" coords="72,3,131,15" coords="72,3,131,15" href="javascript:%20d.closeAll()" href="javascript:%20d.closeAll()">
</MAP>
</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
<SCRIPT type=text/javascript>
        d = new tree('d','../');
        <%
            TreeDAO treedao = new TreeDAO();
            Vector vec =treedao.getTree();
            Iterator iterator = vec.iterator();
            while(iterator.hasNext()){
            TreeNode treenode = (TreeNode)iterator.next();
            if(treenode.getIsleaf()==0){
        %>
         d.add(<%=treenode.getTid()%>,<%=treenode.getPid()%>,'<%=treenode.getTname()%>')
         <%}else{%>
         d.add(<%=treenode.getTid()%>,<%=treenode.getPid()%>,'<%=treenode.getTname()%>',parent.getUrlByCatalogId('<%=treenode.getTid()%>'),null,'list');
         <%}}%>
document.write(d);
</SCRIPT>
            </td>
        </tr>
    </table>
</body>
</html>


第八步:创建一个框架页面,index.html代码如下,和list_default.htm。

复制代码 代码如下:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzfssx.html