`

java 树形结构设计(八) Struts + Hibernate ...

    博客分类:
  • JAVA
阅读更多

step 12 : 构件树结构页面 GeogrophyLeftTree.jsp

         

jsp 代码
  1. 《%@ page contentType="text/html; charset=gb2312" %》   
  2. 《%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %》   
  3. 《%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %》   
  4. 《%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %》   
  5. 《%@ page import="java.util.List" %》   
  6. 《%@ page import="java.util.Iterator" %》   
  7. 《%@ page import="com.winchannel.common.tree.GeographyNewTree" %》   
  8. 《%@ page import="com.winchannel.base.service.GeographyService"%》   
  9. 《%@ page import="com.winchannel.po.base.DimGeography"%》   
  10.   
  11. 《%   
  12.     response.setHeader("Pragma""No-cache");   
  13.     response.setHeader("Cache-Control""no-cache");   
  14.     response.setDateHeader("Expires", 0);   
  15.     GeographyService service=new GeographyService();   
  16.     List graphyList = service.queryGeography();       
  17. %》   
  18.   
  19. 《html》   
  20. 《head》   
  21. 《title》请选择《/title》   
  22. 《meta http-equiv="Content-Type" content="text/html; charset=gb2312"》   
  23. 《link rel="stylesheet" href="../winchannel.css" type="text/css"》   
  24. 《script language="JavaScript" src="/Select.js"》《/script》   
  25.   
  26. 《STYLE type=text/css》   
  27. #containerul {   
  28.     MARGIN: 0px; PADDING-BOTTOM: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px; TEXT-ALIGN: left;LINE-HEIGHT:20PX;   
  29. }   
  30. #containerul UL {   
  31.     MARGIN: 0px; PADDING-BOTTOM: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px; TEXT-ALIGN: left  
  32. }   
  33. #containerul LI {   
  34.     LIST-STYLE: none;CURSOR: hand; MARGIN: 0px 0px 0px 13px; PADDING-BOTTOM: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px  
  35. }《!-- --》   
  36. #containerul .symbols {   
  37.     BACKGROUND-POSITION: 0px 50%; BACKGROUND-REPEAT: no-repeat; FLOAT: left; HEIGHT: 1em; WIDTH: 12px  
  38. }   
  39. 《/STYLE》   
  40.   
  41. 《script language="JavaScript"》   
  42.     function _check() {   
  43.     }   
  44.   
  45.     var _i = 0;   
  46.   
  47.     var _userList = new Array;   
  48.     《%   
  49.         DimGeography graphyPo = null;   
  50.         Iterator graphyListIndex = graphyList.iterator();   
  51.         while (graphyListIndex.hasNext()) {   
  52.             graphyPo = (DimGeography) graphyListIndex.next();   
  53.     %》   
  54.         _userList[_i] = '《%= graphyPo.getId()%》';   
  55.         _i++;   
  56.         _userList[_i] = '《%= graphyPo.getGeographyName() %》';   
  57.         _i++;   
  58.         _userList[_i] = '《%= graphyPo.getGeographyNameEn() %》';   
  59.         _i++;   
  60.         _userList[_i] = '《%= graphyPo.getGeographyCode() %》';   
  61.         _i++;   
  62.         _userList[_i] = '《%= graphyPo.getCityType1().getItemName() %》';   
  63.         _i++;   
  64.         _userList[_i] = '《%= graphyPo.getCityType2().getItemName() %》';   
  65.         _i++;   
  66.     《%   
  67.         }   
  68.     %》   
  69.   
  70.     function _userSelected(ind) {   
  71.         var sForm = document.oguForm;   
  72.         _selected = false;   
  73.           
  74.         return _selected;   
  75.     }   
  76.   
  77.     var userOrg = 0;   
  78.   
  79.     function _userFilterChange(orgID) {   
  80.      //alert("laskdflsakd"+orgID);   
  81.   
  82.      //     alert("array");   
  83.     
  84.         for (var i=0;i《_userList.length/5;i++) {   
  85.          //alert("for");   
  86.             if (_userList[i * 6] == orgID ) {   
  87.            // alert("0");   
  88.             document.GeographyForm.id.value= _userList[i * 6];   
  89.                      
  90.               document.GeographyForm.graphyName.value= _userList[i * 6+1];   
  91.               document.GeographyForm.graphyNameEn.value= _userList[i * 6+2];   
  92.               document.GeographyForm.graphyCode.value= _userList[i * 6+3];   
  93.               document.GeographyForm.cityTypel.value= _userList[i * 6+4];   
  94.               document.GeographyForm.cityType2.value= _userList[i * 6+5];   
  95.             }   
  96.         }   
  97.         userOrg = orgID;   
  98.     }   
  99.   
  100.     function _save() {   
  101.         var ret = "";   
  102.         var sForm = document.oguForm;   
  103.   
  104.         // 选中的组织   
  105.         var retOrg = "";   
  106.            
  107.         // 选中的人员   
  108.         var retUser = "";   
  109.         var retUserName = "";   
  110.            
  111. //window.alert(sForm.userList.value);   
  112.         // 返回值 userId@userName   
  113.    //     ret = sForm.userList.value;   
  114.     //    window.returnValue = ret;   
  115.         window.close();   
  116.     }   
  117.   
  118.     function _cancel() {   
  119.         if (window.confirm("若取消,该次操作将丢失!")) {   
  120.             window.returnValue = null;   
  121.             window.close();   
  122.         }   
  123.     }   
  124.   
  125.     function _close() {   
  126.         window.returnValue = null;   
  127.         window.close();   
  128.     }   
  129.     《/script》   
  130.   《/head》   
  131. 《html:form action="/geography.do" method="Post"》   
  132. 《html:hidden property="method"/》   
  133. 《html:hidden property="id"/》    
  134. 《html:hidden property="geography.id"/》   
  135. 《html:hidden property="geography.createBy"/》     
  136. 《html:hidden property="geography.createDate"/》    
  137. 《html:hidden property="geography.usageFlag"/》   
  138. 《html:hidden property="geography.geoTreeCode"/》   
  139.   
  140.   
  141. 《body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0"》   
  142. 《table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"》   
  143.   《tr》   
  144.     《td colspan="0" class="baobiao_title"》地理信息设置《/td》   
  145.   《/tr》   
  146.   《tr》   
  147.     《td width="180" valign="top" style="border:5px solid #ffffff; padding-top:5px;  "》   
  148.     《table width="100" height="100%"  border="0" cellpadding="0" cellspacing="0"》   
  149.       《tr》   
  150.         《td valign="top" bgcolor="#DFEFFF" style=" border:1px solid #99ccff; padding-top:5px;  "》   
  151.   
  152.  《%   
  153.     GeographyNewTree orgTree = null;   
  154.     try{   
  155.           
  156.         orgTree = new GeographyNewTree();   
  157.   
  158.         String TopOrgName = new String("地理信息");   
  159.         Integer ParentOrgID = new Integer(0);   
  160.            
  161.        // String Url = new String("javascript:selectChange([orgId])");   
  162.         //orgTree.setOnClick(Url);   
  163.            
  164.         String Url = new String("/geography.do?method=init&geographyID=[orgId]");   
  165.         //orgTree.setOnClick(Url);   
  166.         orgTree.setClickTarget("treeFrame");   
  167.         //orgTree.setTreeItemClick(Url);   
  168.         orgTree.setTreeItemHref(Url);   
  169.         orgTree.setRootId(ParentOrgID);   
  170.         orgTree.setTopName(TopOrgName);   
  171.  %》   
  172.  《%=orgTree.getHtml()%》   
  173.  《%   
  174.     } catch (Exception e) {   
  175.         e.printStackTrace();   
  176.     }   
  177.  %》                                
  178.      《/td》   
  179.       《/tr》   
  180.     《/table》《/td》   
  181.   
  182.   
  183.   
  184.   《/tr》   
  185. 《/table》   
  186.     
  187. 《/body》《/html:form》   
  188.   
  189. 《/html》   
  190. 《SCRIPT language="javascript"》   
  191.   
  192.   function save(){   
  193.     document.GeographyForm.method.value="create";   
  194.     // alert("11111111");   
  195.     document.GeographyForm.state.value="save";   
  196.     document.GeographyForm.submit();   
  197.   }   
  198.   function modify(){   
  199.      //alert("lksdflksadf");   
  200.      document.GeographyForm.method.value="modify";   
  201.      document.GeographyForm.submit();   
  202.   }   
  203.    function delet(){   
  204.     //alert("lksdflksadf");   
  205.     document.GeographyForm.method.value="delete";   
  206.     // alert("222222222");   
  207.     document.GeographyForm.submit();   
  208.   }   
  209.      
  210.   function _selectChange(orgId){   
  211.     // alert("----------》"+orgId);   
  212.     document.GeographyForm.id.value=orgId;   
  213.     document.GeographyForm.method.value="init";   
  214.     document.GeographyForm.submit();   
  215.   }   
  216.   function selectOK(){   
  217.         var ret = new Object();   
  218.         var orgIds = document.GeographyForm.listId;   
  219.          if(orgIds.length !=null){   
  220.             for (i=0;i《orgIds.length;i++)   
  221.               {   
  222.                var orgId;   
  223.                 if(orgIds[i].checked == true){   
  224.                 orgId =orgIds[i].value;   
  225.                 _userFilterChange(orgId);   
  226.                }   
  227.               }   
  228.         }   
  229.   }   
  230.      
  231.   function mgnGeoTree(geoId){   
  232.   url="/geography.do?method=init&geographyID=" + geoId;   
  233.   window.location=url;   
  234.   }   
  235.      
  236. 《/SCRIPT》   

  • 描述: 运行结果
  • 大小: 28.4 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics