mail.jsp:
<%@ page contentType="text/html; charset=GBK" %>
<frameset id="fst1" framespacing="0" border="0" frameborder="0" rows="94,*,0">
<frame name="ctiFrm" scrolling="no" noresize target="contents" src="top.jsp">
<frameset id="fst2" cols="241,*" border="2">
<frame name="leftframe" target="leftFrame" src="mulushu2.jsp" scrolling="auto">
<frame name="mainframe" scrolling="auto" noresize src="mainPage.jsp">
</frameset>
<frame name="setSessionFrm" scrolling="no" noresize target="setsession" src="setsession.jsp">
<noframes>
<body>
</body>
</noframes>
</frameset>
mulushu2.jsp
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="test.*,java.util.*" %>
<html>
<%
ArrayList list = new ArrayList();
sort sort_a = new sort();
sort sort_b = new sort();
sort sort_c = new sort();
sort_a.setSortid("1");
sort_a.setP_sortid("0");
sort_a.setC_sortid("11");
sort_a.setDesc("借记卡");
list.add(sort_a);
sort_b.setSortid("2");
sort_b.setP_sortid("0");
sort_b.setC_sortid("");
sort_b.setDesc("贷记卡");
list.add(sort_b);
sort_c.setSortid("11");
sort_c.setP_sortid("1");
sort_c.setC_sortid("");
sort_c.setDesc("借记卡查询");
list.add(sort_c);
System.out.println("size==="+list.size());
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>目录树实例</title>
<script src="alai_tree.js"></script>
</head>
<body style="margin:6 6 6 2;" style="overflow:auto;">
<div nowrap="true" id="divTree"></div>
<script>
var images=new alai_imagelist()
images.path="images/"
images.add("fold")
images.add("fold","default")
images.add("expand_xp","expand")
images.add("collapse_xp","collapse")
var tree1=new alai_tree(images,18,divTree)
tree1.afteradd=function(srcNode)
{
if(srcNode.parent!=tree1.root)srcNode.parent.icon.src=images.item["fold"].src
}
var root=tree1.root
<%
for(int i=0;i<list.size();i++)
{
sort s = (sort)list.get(i);
String sortid=s.getSortid();
String p_sortid=s.getP_sortid();
String c_sortid=s.getC_sortid();
String desc = s.getDesc();
System.out.println("p_sortid==="+p_sortid);
if(p_sortid.equals("0") && !c_sortid.equals("")){
%>
n_tree<%=i%>=root.add("<%=desc%>")
<%
}
else if(p_sortid.equals("0") && c_sortid.equals(""))
{
%>
n_tree<%=i%>=root.addLink("serverlet1?a=<%=sortid%>","<%=desc%>","mainframe","")
<%
}
else{
for(int j=0;j<list.size();j++)
{
sort ss = (sort)list.get(j);
String sortid_1 = ss.getSortid();
String desc_1 = ss.getDesc();
if(sortid_1.equals(p_sortid) && !c_sortid.equals(""))
{%>
n_tree_1<%=j%>=n_tree<%=j%>.add("<%=desc%>")
<%
}else if(sortid_1.equals(p_sortid) && c_sortid.equals(""))
{
%>
n_tree_1<%=j%>=n_tree<%=j%>.addLink("serverlet1?a=<%=sortid%>","<%=desc%>","mainframe","")
<%
}
}}}
%>
tree1.expandAll(false) //全部收缩目录树
n_main.expand(true) //展开主菜单
tree1.target="right" //在框架网页右边窗口打开链接!
images.add("images/set.gif","set")
n_style.icon.src=images.item["set"].src
n_style.label.style.color="red"
</script>
</body>
</html>
Serverlet1.java:
package test;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class Serverlet1 extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=GBK";
//Initialize global variables
public void init() throws ServletException {
}
//Process the HTTP Get request
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
String aa = request.getParameter("a");
System.out.println("sortid======"+aa);
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head><title>Serverlet1</title></head>");
out.println("<body bgcolor=\"#ffffff\">");
out.println("<p>The servlet has received a GET. This is the reply.</p>");
out.println("<p>类名="+aa+"</p>");
out.println("</body></html>");
}
//Clean up resources
public void destroy() {
}
}
posted on 2007-07-12 12:53
Scott.Pan 阅读(792)
评论(1) 编辑 收藏 所属分类:
代码收藏夹