欢迎光临
我们一直在努力

JSP实现树型组织架构(2)–显示orgView-JSP教程,Jsp/Servlet

建站超值云服务器,限时71元/月

//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">&nbsp;&nbsp;&nbsp;</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">&nbsp;</td>

<td width="19%" height="18">&nbsp;</td>

<td width="19%" height="18">&nbsp;</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();

string qb=null;

string qbtemp=null;

string qbtemp1=null;

while( rs3.next()){

qb=rs3.getstring("total");

qbtemp=qb.substring(3,5);

qbtemp1=qb.substring(3,6);

%>

<tr bgcolor="#f0f8ff">

<td width="29%" height="18">&nbsp;</td>

<td width="19%" height="18"><%=rs3.getstring("name")%></td>

<td width="19%" height="18">&nbsp;</td>

<td width="19%" height="18">&nbsp;</td>

</tr>

<%

ps=conn.preparestatement(querycount);

querynamecondition=qbtemp1+"%";

//out.println(querynamecondition);

ps.setstring(1, querynamecondition);

resultset rs4=ps.executequery();

int result2=1;

while(rs4.next())

{ result2++;}

//out.println(result);

for( i=1; i<=result2; i++){

ps=conn.preparestatement(queryname) ;

ps.setstring(1, querynamecondition);

resultset rs5=ps.executequery();

string qc=null;

string qctemp=null;

string qctemp1=null;

while( rs5.next()){

qc=rs5.getstring("total");

qctemp=qc.substring(3,5);

qctemp1=qc.substring(3,6);

%>

<tr bgcolor="#f0f8ff">

<td width="29%" height="18">&nbsp;</td>

<td width="19%" height="18">&nbsp;</td>

<td width="19%" height="18"><%=rs5.getstring("name")%></td>

<td width="19%" height="18">&nbsp;</td>

</tr>

<%

/* ps=conn.preparestatement(queryc2);

resultset qd2=ps.executequery();

int cd2=0;

while(qd2.next())

{cd2++;}

out.println(cd2);

ps=conn.preparestatement(querycount);

if(cd2>0)

{ querynamecondition="d"+(i+19)+"%";}

else

{ querynamecondition="d"+(i+9)+"%";}*/

ps=conn.preparestatement(querycount);

querynamecondition=qctemp1+"%";

//out.println(querynamecondition);

ps.setstring(1, querynamecondition);

resultset rs6=ps.executequery();

int result3=1;

while(rs6.next())

{ result3++;}

//out.println(result3);

for( i=1; i<=result3; i++){

ps=conn.preparestatement(queryname) ;

ps.setstring(1, querynamecondition);

resultset rs7=ps.executequery();

while( rs7.next()){

%>

<tr bgcolor="#f0f8ff">

<td width="29%" height="18">&nbsp;</td>

<td width="19%" height="18">&nbsp;</td>

<td width="19%" height="18">&nbsp;</td>

<td width="19%" height="18"><%=rs7.getstring("name")%></td>

</tr>

<%

ps=conn.preparestatement(querycount);

querynamecondition="e"+(i+9)+"%";

//out.println(querynamecondition);

ps.setstring(1, querynamecondition);

resultset rs8=ps.executequery();

int result4=1;

while(rs8.next())

{ result4++;}

//out.println(result3);

for( i=1; i<=result4; i++){

ps=conn.preparestatement(queryname) ;

ps.setstring(1, querynamecondition);

resultset rs9=ps.executequery();

while(rs9.next()){

rs9.getstring("name"); %>

<%}}%>

<%}}%>

<% }}%>

<% }}%>

<%}}%>

</table>

</body>

<%}

catch(sqlexception se1)

{se1.printstacktrace();}

finally{conn.close();}%>

</html>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » JSP实现树型组织架构(2)–显示orgView-JSP教程,Jsp/Servlet
分享到: 更多 (0)