欢迎光临
我们一直在努力

JSP实现树型组织架构(7)–修改orgManage.jsp-JSP教程,Jsp/Servlet

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

 

<%@ 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}
.style2 {color: #0066ff}
–>
    </style>
  </head>
  <body>
    <form action=”orginsert.jsp”>
      <fieldset>
        <legend align=”right”>
          <span class=”style2″>新增組織架構</span>
        </legend>
        <p align=”left” class=”style2″>所 &nbsp;屬 &nbsp;&nbsp;部 &nbsp;門
  
   
   
    <select name=”fdep”>
  <optgroup label=”總經理室”>
  <option value=”總經理室”>總經理室
    <%
     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 ors1=ps.executequery();
     string qa=null;
     string qatemp=null;
     string qatemp1=null;
     string obdep=null;
     string ocdep=null;
    
     while( ors1.next()){
      qa=ors1.getstring(“total”);
     qatemp=qa.substring(3,5);
     qatemp1=qa.substring(3,6);
   
     %>
  
    
     <%
        querynamecondition=qatemp1+”%”;
     //out.println(querynamecondition);
     ps.setstring(1, querynamecondition);
     resultset ors2=ps.executequery();
     int oresult1=1;
     while(ors2.next())
     { oresult1++;}
     //out.println(result1);
     for(  i=1; i<=oresult1; i++){
     ps=conn.preparestatement(queryname) ;
     ps.setstring(1, querynamecondition);
     resultset ors3=ps.executequery();
     string qb=null;
     string qbtemp=null;
     string qbtemp1=null;
     while( ors3.next()){
    
     qb=ors3.getstring(“total”);
     qbtemp=qb.substring(3,5);
     qbtemp1=qb.substring(3,6);
     obdep=ors3.getstring(“name”);
     %>
      <br>
      <optgroup label=”<%=obdep%>”>
     <option value=”<%=obdep%>”><%=obdep%>
     <%
     ps=conn.preparestatement(querycount);
    
      querynamecondition=qbtemp1+”%”;
   
     
    
     //out.println(querynamecondition);
     ps.setstring(1, querynamecondition);
     resultset ors4=ps.executequery();
     int oresult2=1;
     while(ors4.next())
     { oresult2++;}
     //out.println(result);
     for(  i=1; i<=oresult2; i++){
     ps=conn.preparestatement(queryname) ;
     ps.setstring(1, querynamecondition);
     resultset ors5=ps.executequery();
     string qc=null;
     string qctemp=null;
     string qctemp1=null;
     while( ors5.next()){
     qc=ors5.getstring(“total”);
     qctemp=qc.substring(3,5);
     qctemp1=qc.substring(3,6);
     ocdep=ors5.getstring(“name”);
     %>
     <option value=<%=ocdep%>><%=ocdep%>
    
     <br>
     <%
        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()){}}
     }
       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()){
    }}
          %> </optgroup><%
     }

     }}
      
    
    }
   
    }
     %>
    
   
   
   
    <!–optgroup label=”製造處”>
  <option value=”製造處”>製造處
  <option value=”製造一部”>製造一部
  <option value=”製造二部”>製造二部
  <option value=”製造三部”>製造三部
  </optgroup–>
  
   <%
       }
  catch(sqlexception ose1)
  {ose1.printstacktrace();}
%>
  
  </select>
  </p>
        <p align=”left” class=”style2″>新增部門名稱
        <input type=”text” name=”dep”/>
       <input type=”submit” id=”submit” value=”確認”>
        </p>
      </fieldset>
    </form>
  <font color=”#0099ff” size=4></font>
  <center>
 
 
 <font color=”#0099ff” size=4><center>******有限公司組織架構圖</center></font>

  <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>
      <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(3,5);
     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>
      <td width=”19%” height=”18″>&nbsp;<!–a href=”orgdelete.jsp?name=<%=rs1.getstring(“name”)%>”>刪除部門</a–></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>
      <td width=”19%” height=”18″><a href=”orgdelete.jsp?name=<%=rs3.getstring(“name”)%>”>刪除部門</a></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>
      <td width=”19%” height=”18″><a href=”orgdelete.jsp?name=<%=rs5.getstring(“name”)%>”>刪除部門</a></td>
    </tr>
    <%
    

     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>
      <td width=”19%” height=”18″><a href=”orgdelete.jsp?name=<%=rs7.getstring(“name”)%>”>刪除部門</a></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实现树型组织架构(7)–修改orgManage.jsp-JSP教程,Jsp/Servlet
分享到: 更多 (0)