http://expert.csdn.net/Expert/topic/1510/1510939.xml?temp=.5489771
解决方案 »
- 我想在jsp页面的左边显示一个树形控件,类似于asp.net工具箱或treeview那样的。请问:如何实现呢?
- 关于hibernate外键表ID查询的疑问
- 时间转换成功却又显示失败?
- jscookmenu 在Tiles显示不出菜单的问题,大家帮忙看看!!
- 想问B/S软件如何开发
- SQL 数据库链接错误
- 在JSP中用bean封装常用的功能(详解)
- servlet页面提交后如何在程序中跳转到另一个系统的页面并传递相关参数?
- 关于Servlet的问题?????????
- Dao和Service都用了基类,非通用类写在专属service出错,写在action正常
- 求动态维护树型结构的实现!通过浏览器。最好是JSP实现。
- 关于树型菜单。非常急??????????
<!-- conn.jsp -->
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=tree";
//Database后面值为你的数据库名
String user="sa";//用户
String password="";//密码
Connection conn= DriverManager.getConnection(url,user,password);
Statement smt=conn.createStatement(),smt_1=conn.createStatement(),smt_2=conn.createStatement();
//Statement
String sql;
%><!-- tree.jsp -->
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.lang.*"%>
<%@include file="conn.jsp"%>
<html>
<head>
<link href="inc/style.css" rel="stylesheet">
<title>树型目录</title>
</head>
<script language="JavaScript">
<!--
function mover(where){
where.style.cursor='hand';
}
function mout(where){
//where.style.cursor='hand';
}
function view(obj,pic)
{
if (document.all[obj].style.display=="")
{
document.all[obj].style.display="none";
//alert("合并");
pic.all.tags('img')[0].src="images/icon-folder1-close.gif";
pic.all.tags('img')[1].src="images/icon_close.gif";
}
else
{
document.all[obj].style.display="";
//alert("打开");
pic.all.tags('img')[0].src="images/icon-folder1-open.gif";
pic.all.tags('img')[1].src="images/icon_open.gif";
}
}
//-->
</script>
<body>
<%
String str1;
sql="select * from f_item";
ResultSet F_rs=smt_1.executeQuery(sql);
while(F_rs.next())
{
str1=F_rs.getString("F_Name");
//out.print(str1);
%>
<table OnMouseOver="mover(this)" OnMouseOut="mout(this)" OnClick="view('Label<%=F_rs.getString("id")%>',this)" height="16" border="0" cellpadding="0" cellspacing="1">
<tr>
<td><img src="images/icon-folder1-close.gif" width="15" height="13"><img src="images/icon_close.gif" width="16" height="16"><%=F_rs.getString("F_Name")%></td>
</tr>
</table>
<DIV id=Label<%=F_rs.getString("id")%> style="display:none">
<table width="200" height="16" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<%
sql="select * from s_item where f_name='"+str1+"'";
ResultSet rs_s=smt_2.executeQuery(sql);
while(rs_s.next())
{
%>
<tr>
<td width="50" valign="top"><font color="#FF0000"><img src="images/blank.gif" width="50" height="16"></font></td>
<td height="16"><font color="#FF0000"><%=rs_s.getString("S_Name")%></font></td>
</tr>
<%
}
%>
</table>
</DIV>
<%
}
%>
</body>
</html>