dtree与jstl结合使用的示例

展示了使用JSTL标签、Oracle层次查询、dtree结合使用的方法。
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%--菜单树显示--%>
<sql:query var="menuitems">
	select ID,PID,name,url,tipinfo,target from MENU_TREE 
	start with PID=0 connect by prior  ID=PID order siblings by ID
</sql:query>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>使用dtree呈现菜单树</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="tree">
	<meta http-equiv="description" content="left tree">
	<script type="text/javascript" src="wtree.js"></script>
	<link rel="stylesheet" href="wtree.css" type="text/css" />
	<style type="text/css">
		body{
			margin:0px;
			scrollbar-face-color: #c4dbfa; 	
			scrollbar-highlight-color: #ffffff; 	
			scrollbar-shadow-color: #ffffff;	
			scrollbar-3dlight-color: #ecede8; 	
			scrollbar-arrow-color: #45527c; 	
			scrollbar-track-color: #f5f4ef; 	
			scrollbar-darkshadow-color: #a0aace;
		}
		#leftbar, #treecontainer{
			float:left;
		}
		#leftbar{
			background-image:url("leftbar.gif");
			background-repeat:no-repeat;
			width:21px;
			height:100%;
			background-color:#0482c5;
		}
		#treecontainer{
			background-image:url("tree_bk.jpg");
			background-repeat:repeat-y;
			width:179px;
			height:100%;
			overflow:auto;
			border-width:0px 2px 0px 0px;
			border-color:#c4dbfa;
			border-style:solid;
		}
	</style>
  </head>
  
  <body>
  	<div id="leftbar"></div>
  	<div id="treecontainer">
  <script type="text/javascript">
  	//var father = "";
  	var rootid=999999;
    mytree = new dTree('mytree');
    mytree.config.useCookies=false;
	<c:forEach var="row" items="${menuitems.rows}">
       		mytree.add(${row.id},${row.pid}, "${row.name}","${row.url}","${row.tipinfo}","${row.target}"); 	
	</c:forEach>
    document.write(mytree);
	</script>
</div>
  </body>
</html>

/***********本人原创,欢迎转载,转载请保留本人信息*************/
作者:wallimn 电邮:[email protected] 时间:2009-02-28
博客: http://wallimn.iteye.com
    http://blog.csdn.net/wallimn
网络硬盘:http://wallimn.ys168.com
/***********文章发表请与本人联系,作者保留所有权利*************/

你可能感兴趣的:(java,oracle,sql,jsp,sun)