Class (First-level column information): classId (Automatic numbering), className (column name), NClass (Level two column information), NCLASSID (automatic numbering), nclassname (column name), ParentID (first-level column ID, Associated with the ClassID in the class table)
<%@ page contenttype=text/html; charset=gb2312 Language=java errorpage=. /error.jsp%>
<%@ include file=. /conn.jsp%>
<%@ include file=. /ds.jsp%>
<%@ taglib uri=http://java.sun.com/jsp/jstl/sql Divfix=sql%>
<%request.setcharacterencoding (gb2312); %>
<HTML><HEAD>
<meta Http-equiv=content-type content=text/html; Charset=gb2312>
<TITLE> cascading Menu </TITLE>
<link Rel=stylesheet type=text/css href=style.css>
</HEAD>
<!--get two-level column information from the database-->
<%string Sql=select * from NClass ORDER by nclassid ASC;
ResultSet rs=stmt.executequery (SQL);
%>
<!--to save the level two column information to the array subcat-->
<script type=text/javascript>
var Onecount;
onecount=0;
subcat = new Array ();
<%
int count = 0;
while (Rs.next ()) {
%>
SUBCAT[<%=COUNT%>] = new Array (<%=rs.getstring (nclassname)%>
<%=rs.getstring (NCLASSID)%>,<%=rs.getstring (parentid)%>);
<%
count++;
}
Rs.close ();
%>
onecount=<%=count%>;
<!--determine the function--> the Select display
function Changelocation (LocationID)
{
document.myform.NclassId.length = 0;
var Locationid=locationid;
var i;
For (I=0;i < onecount; i++)
{
if (subcat[i][2] = = LocationID)
{
Document.myform.nclassid.options[document.myform.nclassid.length] = new
Option (Subcat[i][0], subcat[i][1]);
}
}
}
</script>
<form method=post Name=myform action=adminsave.jsp?action=add>
<TABLE>
<TR>
<TD> First Class </TD>
<TD>
<select Name=classid onchange=changelocation (document.myform.classId.options
[Document.myform.classid.selectedindex].value) size=1>
<option selected value>== Please select one level of classification ==</option>
<sql:query Var=query datasource=$>
SELECT * FROM class
</sql:query>
<c:foreach Var=row items=$>
<option value=$>$</option>
</c:forEach>
</select>
</TD>
<TD> Select Class Two </TD>
<TD>
<select name=nclassid>
<option Selected value>== Please select Class Two classification ==</option>
</SELECT>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
<%@ page contenttype=text/html; charset=gb2312 Language=java errorpage=. /error.jsp%>
<%@ include file=. /conn.jsp%>
<%@ include file=. /ds.jsp%>
<%@ taglib uri=http://java.sun.com/jsp/jstl/sql Divfix=sql%>
<%request.setcharacterencoding (gb2312); %>
<HTML><HEAD>
<meta Http-equiv=content-type content=text/html; Charset=gb2312>
<TITLE> cascading Menu </TITLE>
<link Rel=stylesheet type=text/css href=style.css>
</HEAD>
<!--get two-level column information from the database-->
<%string Sql=select * from NClass ORDER by nclassid ASC;
ResultSet rs=stmt.executequery (SQL);
%>
<!--to save the level two column information to the array subcat-->
<script type=text/javascript>
var Onecount;
onecount=0;
subcat = new Array ();
<%
int count = 0;
while (Rs.next ()) {
%>
SUBCAT[<%=COUNT%>] = new Array (<%=rs.getstring (nclassname)%>
<%=rs.getstring (NCLASSID)%>,<%=rs.getstring (parentid)%>);
<%
count++;
}
Rs.close ();
%>
onecount=<%=count%>;
<!--determine the function--> the Select display
function Changelocation (LocationID)
{
document.myform.NclassId.length = 0;
var Locationid=locationid;
var i;
For (I=0;i < onecount; i++)
{
if (subcat[i][2] = = LocationID)
{
Document.myform.nclassid.options[document.myform.nclassid.length] = new
Option (Subcat[i][0], subcat[i][1]);
}
}
}
</script>
<form method=post Name=myform action=adminsave.jsp?action=add>
<TABLE>
<TR>
<TD> First Class </TD>
<TD>
<select Name=classid onchange=changelocation (document.myform.classId.options
[Document.myform.classid.selectedindex].value) size=1>
<option selected value>== Please select one level of classification ==</option>
<sql:query Var=query datasource=$>
SELECT * FROM class
</sql:query>
<c:foreach Var=row items=$>
<option value=$>$</option>
</c:forEach>
</select>
</TD>
<TD> Select Class Two </TD>
<TD>
<select name=nclassid>
<option Selected value>== Please select Class Two classification ==</option>
</SELECT>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>