JSP实现树型组织架构(2)--显示orgView__教程 |
|
日期:2007-5-20 1:14:52 人气:105 [大 中 小] |
|
|
|
//orgView.jsp
<%@ page contentType="text/html;charset=Big5"%> <%@ include file="orgConnInclude.jsp"%>
<% request.setCharacterEncoding("big5"); PreparedStatement ps=null; ResultSet rs=null;
String queryCount=" select count(*) "+ " from ngb_org "+ " where total like ? ORDER BY TOTAL ";
String queryName=" select * "+ " from ngb_org "+ " where total like ? ORDER BY TOTAL ";
%>
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=Big5"> <title>組織架構</title> <style type="text/css"> <!-- .style1 {color: #FFFFFF} --> </style> </head> <body> <font color="#0099FF" size=4><center>*****有限公司組織架構圖</center></font> <div align="right"><a href="orgManage.jsp">管理入口</a> </div> <table width="100%" border="1" cellspacing="1" cellpadding="1"> <tr> <!--th width="7%" rowspan="2" bgcolor="#0099FF" scope="col"> </th--> <th width="29%" bgcolor="#0099FF" scope="col"><span class="style1">總經理</span></th> <th width="19%" bgcolor="#0099FF" scope="col"><span class="style1">總經理直屬</span></th> <th width="19%" bgcolor="#0099FF" scope="col"><span class="style1">處級所屬</span></th> <th width="19%" bgcolor="#0099FF" scope="col"><span class="style1">部級所屬</span></th> </tr> <% try{ int i=1; ps=conn.prepareStatement(queryCount); ps.setString(1, "A10%"); rs=ps.executeQuery(); int result=1; while(rs.next()) { result++;} //out.println(result);
for( i=1; i<=result; i++){ ps=conn.prepareStatement(queryName) ; String queryNameCondition="A"+(9+i)+"%"; //out.println(queryNameCondition); ps.setString(1, queryNameCondition); ResultSet rs1=ps.executeQuery(); String qa=null; String qaTemp=null; String qaTemp1=null;
while( rs1.next()){ qa=rs1.getString("total"); qaTemp=qa.substring(0,3); qaTemp1=qa.substring(3,6);
%>
<tr bgcolor="#F0F8FF"> <td width="29%" height="18"><%=rs1.getString("name")%></td> <td width="19%" height="18"> </td> <td width="19%" height="18"> </td> <td width="19%" height="18"> </td> </tr> <%
queryNameCondition=qaTemp1+"%"; //out.println(queryNameCondition); ps.setString(1, queryNameCondition); ResultSet rs2=ps.executeQuery(); int result1=1; while(rs2.next()) { result1++;} //out.println(result1); for( i=1; i<=result1; i++){ ps=conn.prepareStatement(queryName) ; ps.setString(1, queryNameCondition); ResultSet rs3=ps.executeQuery(); |
|
出处:本站原创 作者:佚名 |
|
|