缺少有括号},请主要下面的代码中标记为!!!!!!!!!!的地方<%@ page contentType="text/html;charset=GB2312"%>
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="workM" scope="page" class="test.faq"/>
<html>
<head>
<title>无限级菜单测试</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><script language="javascript">
function expands(expid,picid) //显示图片张合的Js
{ // alert("this.document.all["+expid+"].style.display");
if(this.document.all[expid].style.display=="none")
{ this.document.all[expid].style.display="block";
this.document.all[picid].src="line_01_02.gif"; }
else
{
this.document.all[expid].style.display="none";
this.document.all[picid].src="line_01.gif";
}
}
</script>
</head><body bgcolor="#FFFFFF" text="#000000">
<%
try {
ResultSet rs=workM.executeQuery("select * from board1 where parentid=0");
int id=rs.getInt("id");
String boardname=rs.getString("boardname");
}
catch (SQLException e)
{
}
%>
<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" width="766" bordercolor="#DDCF90" height="392">
<tr>
<td valign="top">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="372">
<tr>
<td width="368"><a onclick="javascript:expands('dwtop','dwimg')" style="cursor:hand"><span align="absmiddle"> <img id="dwimg" SRC="line_01.gif" border="0" align="absmiddle" width="35" height="17"></span></a><font size="2"><a href="tree.jsp?parentid=<%=id%>"><%=boardname%></a></font>
<table id="dwtop" style="display=none" cellspacing="0" cellpadding="0">
<%
ListChildTree(0,0);
%>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</center>
</div>
</body>
</html>
<%!
public void ListChildTree(int parentid,int level){
try {
ResultSet rs=workM.executeQuery("select * from board1 where parentid=0");
String sql="";
while (rs.next())
{
int id=rs.getInt("id");
String boardname=rs.getString("boardname");
int level=rs.getInt("level");
String space="";
for (int j=0;j<level;j++)
Space+=" "; //设置显示节点前面的距离,这里的空格的html被这里自动替换成" "了 int childcount=0;
sql ="select count(*) as childcount from board1 where parentid="+id;//查找孩子节点的孩子节点
try {
ResultSet rs1=workM.executeQuery(sql);
if (rs1.next())
{
childcount=rs1.getInt("childcount");
}
rs1.close();
}
catch (SQLException e){
}
int TableId=childcount; //设置表格Id
int TablePic=childcount; //设置图片Id
if (childcount=0)
{
%>
<tr><td><%=Space%><span align="absmiddle"><img src="line_01_02.gif" border="0" align="absmiddle" width="35" height="17"></span><font size="2"><A href="process.php"><%=rs.getString("boardname")%></a></font>
<table id="<'%=TableId%'>" style="display=none" cellspacing="0" cellpadding="0">
<%
}
else
{
%>
<tr><td><%=Space%><a onclick="javascript:expands('<%=$TableId%>','<%=$TablePic%>')" style="cursor:hand"><span align="absmiddle"><img id="<%=$TablePic%>" src="line_01.gif" border="0" align="absmiddle" width="35" height="17"></span></a><font size="2"><%=boardname%></a></font>
<table id="<%=TableId%>" style="display=none" cellspacing="0" cellpadding="0">
<%
ListChildTree(id,level);//递归调用函数本身来显示其他孩子节点
}%>
</table>
<%
}
}!!!!!!!!!!!此处缺少
catch (SQLException e)
{
}
}
%>
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="workM" scope="page" class="test.faq"/>
<html>
<head>
<title>无限级菜单测试</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><script language="javascript">
function expands(expid,picid) //显示图片张合的Js
{ // alert("this.document.all["+expid+"].style.display");
if(this.document.all[expid].style.display=="none")
{ this.document.all[expid].style.display="block";
this.document.all[picid].src="line_01_02.gif"; }
else
{
this.document.all[expid].style.display="none";
this.document.all[picid].src="line_01.gif";
}
}
</script>
</head><body bgcolor="#FFFFFF" text="#000000">
<%
try {
ResultSet rs=workM.executeQuery("select * from board1 where parentid=0");
int id=rs.getInt("id");
String boardname=rs.getString("boardname");
}
catch (SQLException e)
{
}
%>
<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" width="766" bordercolor="#DDCF90" height="392">
<tr>
<td valign="top">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="372">
<tr>
<td width="368"><a onclick="javascript:expands('dwtop','dwimg')" style="cursor:hand"><span align="absmiddle"> <img id="dwimg" SRC="line_01.gif" border="0" align="absmiddle" width="35" height="17"></span></a><font size="2"><a href="tree.jsp?parentid=<%=id%>"><%=boardname%></a></font>
<table id="dwtop" style="display=none" cellspacing="0" cellpadding="0">
<%
ListChildTree(0,0);
%>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</center>
</div>
</body>
</html>
<%!
public void ListChildTree(int parentid,int level){
try {
ResultSet rs=workM.executeQuery("select * from board1 where parentid=0");
String sql="";
while (rs.next())
{
int id=rs.getInt("id");
String boardname=rs.getString("boardname");
int level=rs.getInt("level");
String space="";
for (int j=0;j<level;j++)
Space+=" "; //设置显示节点前面的距离,这里的空格的html被这里自动替换成" "了 int childcount=0;
sql ="select count(*) as childcount from board1 where parentid="+id;//查找孩子节点的孩子节点
try {
ResultSet rs1=workM.executeQuery(sql);
if (rs1.next())
{
childcount=rs1.getInt("childcount");
}
rs1.close();
}
catch (SQLException e){
}
int TableId=childcount; //设置表格Id
int TablePic=childcount; //设置图片Id
if (childcount=0)
{
%>
<tr><td><%=Space%><span align="absmiddle"><img src="line_01_02.gif" border="0" align="absmiddle" width="35" height="17"></span><font size="2"><A href="process.php"><%=rs.getString("boardname")%></a></font>
<table id="<'%=TableId%'>" style="display=none" cellspacing="0" cellpadding="0">
<%
}
else
{
%>
<tr><td><%=Space%><a onclick="javascript:expands('<%=$TableId%>','<%=$TablePic%>')" style="cursor:hand"><span align="absmiddle"><img id="<%=$TablePic%>" src="line_01.gif" border="0" align="absmiddle" width="35" height="17"></span></a><font size="2"><%=boardname%></a></font>
<table id="<%=TableId%>" style="display=none" cellspacing="0" cellpadding="0">
<%
ListChildTree(id,level);//递归调用函数本身来显示其他孩子节点
}%>
</table>
<%
}
}!!!!!!!!!!!此处缺少
catch (SQLException e)
{
}
}
%>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货