|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
自己的整个学习思路完全被老师的讲课思路所牵制,这样几节课听下来,恐怕自己的见解都应该是书里的知识点了,根本谈不上自身发现问题,分析问题,和解决问题能力的切实提高。 class(一级栏目信息):classId(主动编号),className(栏目称号),Nclass(二级栏目信息),NclassId(主动编号),NclassName(栏目称号),parentId(一级栏目id,与class表中的classId联系关系)
<%@pagecontentType=text/html;charset=GB2312language=javaerrorPage=../error.jsp%>
<%@includefile=../conn.jsp%>
<%@includefile=../ds.jsp%>
<%@tagliburi=http://java.sun.com/jsp/jstl/sqldivfix=sql%>
<%request.setCharacterEncoding(gb2312);%>
<HTML><HEAD>
<METAhttp-equiv=Content-Typecontent=text/html;charset=gb2312>
<TITLE>级联菜单</TITLE>
<LINKrel=stylesheettype=text/CSShref=style.css>
</HEAD>
<!--从数据库中失掉二级栏目信息-->
<%Stringsql=select*fromNclassorderbyNclassIdasc;
ResultSetrs=stmt.executeQuery(sql);
%>
<!--将二级栏目信息保留到数组subcat中-->
<scripttype=text/javascript>
varonecount;
onecount=0;
subcat=newArray();
<%
intcount=0;
while(rs.next()){
%>
subcat[<%=count%>]=newArray(<%=rs.getString(NclassName)%>,
<%=rs.getString(NclassId)%>,<%=rs.getString(parentId)%>);
<%
count++;
}
rs.close();
%>
onecount=<%=count%>;
<!--决意select显现的函数-->
functionchangelocation(locationid)
{
document.myform.NclassId.length=0;
varlocationid=locationid;
vari;
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>
<FORMmethod=POSTname=myformaction=adminsave.jsp?action=add>
<TABLE>
<TR>
<TD>一级分类</TD>
<TD>
<SELECTname=classIdonChange=changelocation(document.myform.classId.options
[document.myform.classId.selectedIndex].value)size=1>
<OPTIONselectedvalue>==请选一级分类==</OPTION>
<sql:queryvar=querydataSource=$>
SELECT*FROMclass
</sql:query>
<c:forEachvar=rowitems=$>
<optionvalue=$>$</option>
</c:forEach>
</select>
</TD>
<TD>选择二级分类</TD>
<TD>
<SELECTname=NclassId>
<OPTIONselectedvalue>==请选二级分类==</OPTION>
</SELECT>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
<%@pagecontentType=text/html;charset=GB2312language=javaerrorPage=../error.jsp%>
<%@includefile=../conn.jsp%>
<%@includefile=../ds.jsp%>
<%@tagliburi=http://java.sun.com/jsp/jstl/sqldivfix=sql%>
<%request.setCharacterEncoding(gb2312);%>
<HTML><HEAD>
<METAhttp-equiv=Content-Typecontent=text/html;charset=gb2312>
<TITLE>级联菜单</TITLE>
<LINKrel=stylesheettype=text/csshref=style.css>
</HEAD>
<!--从数据库中失掉二级栏目信息-->
<%Stringsql=select*fromNclassorderbyNclassIdasc;
ResultSetrs=stmt.executeQuery(sql);
%>
<!--将二级栏目信息保留到数组subcat中-->
<scripttype=text/javascript>
varonecount;
onecount=0;
subcat=newArray();
<%
intcount=0;
while(rs.next()){
%>
subcat[<%=count%>]=newArray(<%=rs.getString(NclassName)%>,
<%=rs.getString(NclassId)%>,<%=rs.getString(parentId)%>);
<%
count++;
}
rs.close();
%>
onecount=<%=count%>;
<!--决意select显现的函数-->
functionchangelocation(locationid)
{
document.myform.NclassId.length=0;
varlocationid=locationid;
vari;
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>
<FORMmethod=POSTname=myformaction=adminsave.jsp?action=add>
<TABLE>
<TR>
<TD>一级分类</TD>
<TD>
<SELECTname=classIdonChange=changelocation(document.myform.classId.options
[document.myform.classId.selectedIndex].value)size=1>
<OPTIONselectedvalue>==请选一级分类==</OPTION>
<sql:queryvar=querydataSource=$>
SELECT*FROMclass
</sql:query>
<c:forEachvar=rowitems=$>
<optionvalue=$>$</option>
</c:forEach>
</select>
</TD>
<TD>选择二级分类</TD>
<TD>
<SELECTname=NclassId>
<OPTIONselectedvalue>==请选二级分类==</OPTION>
</SELECT>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML></p>
首先java功能强大的背后是其复杂性,就拿web来说,当今流行的框架有很多,什么struts,spring,jQuery等等,而这无疑增加了java的复杂性。 |
|