/**
              Create an Ext.tree.TreePanel in the passed Element using
              an XML document from the passed URL, calling the passed
              callback on completion.
              @param el {String/Element/HtmlElement} The tree's container.
              @param url {String} The URL from which to read the XML
              @param callback {function:tree.render} The function to call on completion,
                  defaults to rendering the tree.
          */
          function createXmlTree(el, url, callback) {
              
          var tree = new Ext.tree.TreePanel(el);
              
          var p = new Ext.data.HttpProxy({url:url});
              p.on(
          "loadexception"function(o, response, e) {
                  
          if (e) throw e;
              });
              p.load(
          null, {
                  read: 
          function(response) {
                      
          var doc = response.responseXML;
                      tree.setRootNode(treeNodeFromXml(doc.documentElement 
          || doc));
                  }
              }, callback 
          || tree.render, tree);
              
          return tree;
          }
           
          /**
              Create a TreeNode from an XML node
          */
          function treeNodeFromXml(XmlEl) {
          //    Text is nodeValue to text node, otherwise it's the tag name
              var t = ((XmlEl.nodeType == 3? XmlEl.nodeValue : XmlEl.tagName);

          //    No text, no node.
              if (t.replace(/\s/g,'').length == 0) {
                  
          return null;
              }
              
          var result = new Ext.tree.TreeNode({
                  text : t
              });

          //    For Elements, process attributes and children
              if (XmlEl.nodeType == 1) {
                  Ext.each(XmlEl.attributes, 
          function(a) {
                      
          var c = new Ext.tree.TreeNode({
                          text: a.nodeName
                      });
                      c.appendChild(
          new Ext.tree.TreeNode({
                          text: a.nodeValue
                      }));
                      result.appendChild(c);
                  });
                  Ext.each(XmlEl.childNodes, 
          function(el) {
          //        Only process Elements and TextNodes
                      if ((el.nodeType == 1|| (el.nodeType == 3)) {
                          
          var c = treeNodeFromXml(el);
                          
          if (c) {
                              result.appendChild(c);
                          }
                      }
                  });
              }
              
          return result;
          }

          回頭有空添加詳細注解~~原文中6樓有更詳細的解答  http://extjs.com/forum/showthread.php?t=3987




          posted @ 2008-12-30 11:23 Robert Su 閱讀(944) | 評論 (0)編輯 收藏

          Context initialization failed
          org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'RssService' defined in ServletContext resource
           [/WEB-INF/vbm_dao.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException:
           Invalid property 'rssDao' of bean class [gov.ict.mcg.vbm.services.impl.RssServiceImpl]: Bean property 'rssDao'
           is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
          Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'rssDao' of bean class
          [gov.ict.mcg.vbm.services.impl.RssServiceImpl]: Bean property 'rssDao' is not writable or has an invalid setter method.
           Does the parameter type of the setter match the return type of the getter?
              at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:793)


          原因:
          RssServiceImpl類中忘記添加dao的get set方法~~~

          posted @ 2008-12-29 17:14 Robert Su 閱讀(299) | 評論 (0)編輯 收藏

          Eclipse3.2裝WTP時提示我需要需要3.4的功能組件
          直接download~~~eclipse-jee-ganymede-win32.zip
          就可以了

          posted @ 2008-12-26 11:09 Robert Su 閱讀(569) | 評論 (0)編輯 收藏

          把日期改成int型的,比如20081029
          然后對這個字段建索引

          posted @ 2008-12-19 10:23 Robert Su 閱讀(192) | 評論 (0)編輯 收藏

          cosmos框架主要用來做中小項目開發,丟棄了傳統的SSH架構,利用純的Servlet+JDBC實現數據庫操作。開發Web項目,可以實現無需寫Java代碼, 而實現業務邏輯,并且由于不需要寫Java代碼,因此,可以不需要重啟和重新部署項目,就可以直接測試,達到了開發->刷新測試的水平。根據目前多 個項目的應用實踐看來,基本上可以提高一倍到2/3的開發時間,而且性能比起SSH架構還要高,框架還要更加輕量級。因此,這個框架還是比較能夠體現敏捷 開發的思想的。

          由于框架摒棄了Hibernate的O/R Mapping工具,因此有一個比較大的問題就是關于數據庫移植性的問題,但是,根據公司對于中小項目的經驗,一旦客戶要移植數據庫,幾乎就需要重新實現業務邏輯了,因此,對于中小項目來說,這是一個不錯的選擇。

          ——————
          官方介紹:

          cosmos框架 是一個對于底層數據庫、Web服務、JNDI等進行統一界面封裝的框架,提供統一的調用接口,并采用命令設計模式,將所有需要調用的命令放置到數據庫(或 者其他域)中去,從而可以改變傳統的j2ee應用調試的流程:開發-部署-測試或者開發-部署-重新啟動-測試,達到像PHP、PERL那樣的開發 ->測試的模式。有效地提高了開發速度。

          由于其拋棄了所有的中間層次,包括像Struts、Spring、Hibernate這樣的框架,調用數據庫應用直接用JDBC的方式進行,因此有效地提高了運行性能。 由于開發的代碼可以完全放置到數據庫中,因此,可以比較容易地實現共享開發,從而有效地調動起開發人員的積極性。 在cosmos框架中開發一個數據庫應用的流程是:開發SQL語句或者存儲過程或者函數;然后開發JSP頁面進行展示;最后測試結果。完全地省略了開發Java代碼的過程,因此,有效地提高了開發速度。 cosmos框架是一個能有效地應用于中小項目的框架,可以供開發人員快速建立原型,從而實現敏捷開發的目的。 在框架中還包括權限和認證的部分框架,因此,用戶可以簡單地實現用戶認證和系統權限的功能。


          http://code.google.com/p/cosmos4j/

          posted @ 2008-12-18 16:56 Robert Su 閱讀(625) | 評論 (0)編輯 收藏

          谷歌對亞洲市場的關注,使這家公司在《亞洲華爾街日報》舉辦的“亞洲最受尊敬跨國公司”讀者調查中,排名大幅度提升。在“最能滿足消費者需求的創新公司”分類排行榜上,谷歌位居榜首。這是該公司連續第二年蟬聯創新公司的冠軍。這一排行榜評選的是讀者心目中最善于向市場提供新產品和新服務的公司,以及客戶服務最為周到的公司。

          <漢譯英>

          The Asian focus has helped propel Google up the charts in The Wall Street Journal Asia's reader survey of Asia's most-admired multinationals. Google grabbed the No. 1 spot in the featured category, 'Innovative in Responding to Customer Needs.' It is the second survey in a row Google has held the top spot as an innovator, a category that asks readers to tell us which companies they consider best at bringing new products and services to the market as well as at employing sophisticated customer service.

          posted @ 2008-12-15 00:57 Robert Su 閱讀(119) | 評論 (0)編輯 收藏

          現在這個Grid的右鍵彈出菜單存在一個問題就是右鍵單擊的時候無法直接選擇Grid中的一行
              //right menu
                      grid.on('rowcontextmenu', rightClickFn,grid);
                      
          var rightClick = new Ext.menu.Menu({
                          id:'rightClickCont',
                          items: [
                              {
                                  id: 'rMenu1',
                                  scope:
          this,
                                  text: '審核:1',
                                  handler:
          function(){auditWebVideoSecond(grid,1,true);}
                              },
                              {
                                  id: 'rMenu2',
                                  scope:
          this,
                                  text: '審核:2',
                                  handler:
          function(){auditWebVideoSecond(grid,2,true);}
                              },
                              {
                                  id: 'rMenu3',
                                  scope:
          this,
                                  text: '審核:3',
                                  handler:
          function(){auditWebVideoSecond(grid,3,true);}
                              },
                              {
                                  id: 'rMenu4',
                                  text:'審核:4',
                                  scope:
          this,
                                  handler:
          function(){auditWebVideoSecond(grid,4,true);}
                              }
                          ]
                      });
                      
                      
          function rightClickFn(grid,rowIndex,e){
                          e.preventDefault();
                          rightClick.showAt(e.getXY());                    
                      }
          function auditWebVideoSecond(videoGrid,flag,change){
              
              
          var datas = grid.getSelectionModel().getSelections();
              
          if(datas.length <= 0)
                  
          return;

              
          if(!inputwindow){
                   
          var form = new Ext.form.FormPanel({
                                  
          //baseCls: 'x-plain',
                                  labelWidth: 55,
                                  frame:
          true,
                                  id:'inputwindow_form',
                                  items: [
                                   {
                                      xtype:'fieldset',
                                      title: '處理建議',
                                      collapsible: 
          false,
                                      autoHeight:
          true,
                                      width: 
          350,
                                      defaults: {width: 
          330},
                                      defaultType: 'textarea',
                                      items: [{
                                          hideLabel:
          true,
                                          xtype:'textarea',
                                          name: 'remark',
                                          height:
          80,
                                          id: 'remark'
                                      }]},
                                       {
                                      xtype:'fieldset',
                                      title: '節目來源',
                                      collapsible: 
          false,
                                      autoHeight:
          true,
                                      width: 
          350,
                                      defaults: {width: 
          330},
                                      defaultType: 'textfield',
                                      items: [{
                                          hideLabel:
          true,
                                          xtype:'textarea',
                                          height:
          40,
                                          name: 'program_source',
                                          id: 'program_source'
                                      }]},
                                  {
                                      xtype:'fieldset',
                                      layout:'column',
                                      id:'priority_group',
                                      title: '節目重要程度',
                                      collapsible: 
          false,
                                      autoHeight:
          true,
                                      width: 
          350,
                                      items: [
                                      {
                                          width:
          60,
                                          layout: 'form',
                                         
          // labelWidth: 10,
                                          items: new Ext.form.Radio({id:'priority0',name:'priority',value:"",hideLabel:true,boxLabel:'無',checked:true})
                                      },
                                       {
                                          width:
          80,
                                          layout: 'form',
                                          
          //labelWidth: 40,
                                          items: [new Ext.form.Radio({id:'priority1',name:'priority',value:"0",hideLabel:true,boxLabel:'一般'})]
                                      },
                                       {
                                          width:
          80,
                                          layout: 'form',
                                          
          //labelWidth: 40,
                                          items: [new Ext.form.Radio({id:'priority2',name:'priority',value:"1",hideLabel:true,boxLabel:'重要'})]
                                      }]                            
                                      
                                  }
                                  ]
                              });
                              
                             inputwindow 
          = new Ext.Window({
                                              title: '處理建議',
                                              width: 
          400,
                                              height:
          300,
                                              layout: 'fit',
                                              bodyStyle:'padding:10px;',
                                              buttonAlign:'center',
                                              resizable:
          false,
                                              closeAction:'hide',
                                              modal:
          true,
                                              items: form,
                                              buttons: [{
                                                  text: '保存',
                                                  id:'save_function',
                                             },{
                                                              text: '取消',
                                                              handler:
          function(){
                                                                  inputwindow.hide();
                                                              }
                                                          }]
                                                      });            
                                                  
                                          }
                           
             
          if(flag =='1')
             inputwindow.setTitle('處理建議[1]');
             
          else if(flag =='2')
             inputwindow.setTitle('處理建議[2]');
             
          else if(flag =='3')
             inputwindow.setTitle('處理建議[2]');
             
          else if(flag =='4')
             inputwindow.setTitle('處理建議[4]');
             inputwindow.show();
             

          }


          posted @ 2008-12-12 17:36 Robert Su 閱讀(712) | 評論 (0)編輯 收藏

          一個樹形菜單靜態化到客戶端成一個數組的測試js:
          var tree_arr=[[1,'新浪播客','0'],[2,'tom','0'],[3,'網易播吧','0'],[4,'新浪播客子博客1','1'],[5,'新浪播客子博客2','1']];

          var root=new Ext.tree.TreeNode({
                id:
          "root",
                text:
          "控制面板",
                expanded:
          true
          });
          var mytree=new Ext.tree.TreePanel({
                el:
          "tree",
               
                animate:
          true,
                title:
          "Extjs靜態樹",
                collapsible:
          true,
                enableDD:
          false,
                enableDrag:
          false,
                rootVisible:
          true,
                autoScroll:
          true,
                trackMouseOver:
          false,//false則mouseover無效果
                useArrows:false,
                width:
          150,
                lines:
          true 
            });
          function get_root()
          {
              
          var result=new Array();
              
          /*
              for(var i=0; i<tree_arr.length; i++)
                  if(0 == tree_arr[i][2])
                     root.appendChild(new Ext.tree.TreeNode({
                            id:tree_arr[i][0],
                           text:tree_arr[i][1]
                   }));
              
          */
              
          var j=0;                
               
          for(var i=0; i<tree_arr.length; i++){
               
          if(0 == tree_arr[i][2]){
               result[j
          ++]=tree_arr[i];
                   }
               }
              
          return result;
          }
          function get_sub(parentId)
          {
              
          var result=new Array();
              
          /*
              for(var i=0; i<tree_arr.length; i++){
                  if(0 != tree_arr[i][0]){
                      //var temp=Ext.tree.getNodeById(tree_arr[i][0]);
                      alert(mytree.getNodeById('1'));
                      mytree.getNodeById('1').appendChild(new Ext.tree.TreeNode({
                            id:tree_arr[i][0],
                           text:tree_arr[i][1]
                                       }));
                  }    
              }
              
          */
              
          var j=0;
              
          for(var i=0; i<tree_arr.length; i++){
              
          if(parentId==tree_arr[i][2]){
              result[j]
          =tree_arr[i];
              j
          ++;
              }
              }
              
          return result;
          }


          //生成標簽頁
          var tab = new Ext.TabPanel({
                      region:'center',
                      deferredRender:
          false,
                      activeTab:
          0,
                      resizeTabs:
          true// turn on tab resizing
                      minTabWidth: 115,
                      tabWidth:
          135,
                      enableTabScroll:
          true
                  });

          Ext.onReady(
          function(){
             
          //layout
             var viewport = new Ext.Viewport({
                  layout:'border',
                  items:[
                      
          new Ext.BoxComponent({
                          region:'north',
                          el: 'north',
                          height:
          80
                      }),
          new Ext.BoxComponent({
                          region:'south',
                          el: 'south',
                          height:
          25
                      }),{
                      region:'west',
                      id:'west
          -panel',
                      split:
          true,
                      width: 
          200,
                      minSize: 
          175,
                      maxSize: 
          400,
                      margins:'
          0 0 0 0',
                      layout:'accordion',
                      title:'系統菜單',
                      collapsible :
          true,
                      layoutConfig:{
                          animate:
          true
                          },
                      items: [
                          {
                              title:'EXT控件使用',
                              border:
          false,
                              html:'
          <div id="tree-div" style="overflow:auto;width:100%;height:100%"></div>'
                              
          //iconCls:'nav'
                          }]
                      },
                  tab
          //初始標簽頁
                   ]
              });

              
          //設置樹形面板
              var Tree = Ext.tree;
              
          // set the root node
              var root = new Tree.AsyncTreeNode({
                  text: 'Ext JS',
                  draggable:
          false,
                  id:'root'
              });

          var resultRoot=get_root();
          for(var i=0;i<resultRoot.length;i++){
              
          var rootNode=new Ext.tree.TreeNode({
                            id:resultRoot[i][
          0],
                           text:resultRoot[i][
          1]
                   });
           
          var resultSub=get_sub(resultRoot[i][0]);
           
          for(var j=0;j<resultSub.length;j++){
              
          var subNode=new Ext.tree.TreeNode({
                            id:resultSub[i][
          0],
                           text:resultSub[i][
          1]
                   });
               rootNode.appendChild(subNode);
           }    
            root.appendChild(rootNode);
          }                    

          var contextmenu=new Ext.menu.Menu({
              id:'Context',
              items:[{
                  text:'R_menu1',
                  handler:
          function(){
                      alert('click');
                  }
              }
              ]
              
          });    

          mytree.on('contextmenu',
          function(node,e){
              e.preventDefault();
              node.select();
              contextmenu.showAt(e.getXY());
          });    
              
          mytree.setRootNode(root);
          //設置根節點
          mytree.render();


          });
          Ext.fly(A) is null 開始的時候一直提示這個錯誤~
          后來發現firebug一直提示這個錯誤,每次調試的時候清空下cache比較好~~~

          posted @ 2008-12-12 10:39 Robert Su 閱讀(11906) | 評論 (1)編輯 收藏

          今天數據庫直接超過4G,查了下原來是索引問題,一個索引占了2G大小~~

          posted @ 2008-12-09 11:53 Robert Su 閱讀(224) | 評論 (0)編輯 收藏

           

          <?xml version="1.0" encoding="UTF-8"?>
          <web-app>
           <display-name>系統</display-name>
           <context-param>
            <param-name>log4jConfigLocation</param-name>
            <param-value>/WEB-INF/log4j.properties</param-value>
           </context-param>
           <!-- ContextConfigLocation -->
           <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/vbm_action.xml,/WEB-INF/vbm_hibernate.xml,/WEB-INF/vbm_dao.xml</param-value>
           </context-param>

           <!-- 著名 Character Encoding filter -->

           <filter>
            <filter-name>encodingFilter</filter-name>
            <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
            <init-param>
             <param-name>encoding</param-name>
             <param-value>UTF-8</param-value>
            </init-param>
           </filter>
           <filter>
            <filter-name>struts2</filter-name>
            <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
            <init-param>
             <param-name>config</param-name>
             <param-value>struts-default.xml,struts-plugin.xml,struts.xml,struts_books.xml</param-value>
            </init-param>
           </filter>

           <filter-mapping>
            <filter-name>encodingFilter</filter-name>
            <url-pattern>/*</url-pattern>
           </filter-mapping>
           <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>/*</url-pattern>
           </filter-mapping>
           <!-- 加入jpaFilter,是為了不讓hibernate的session過早關閉,因為有的action會通過ajax動態調用 -->
           <filter>
            <filter-name>jpaFilter</filter-name>
            <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
            <init-param>
             <param-name>entityManagerFactory</param-name>
             <param-value>entityManagerFactory</param-value>
            </init-param>
           </filter>
           <filter-mapping>
            <filter-name>jpaFilter</filter-name>
            <url-pattern>*.htm</url-pattern>
           </filter-mapping>
           <!-- Listener contextConfigLocation -->
           <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
           </listener>
           <!-- Listener log4jConfigLocation -->
           <listener>
            <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
           </listener>
           <!-- Spring 刷新Introspector防止內存泄露 -->
           <listener>
            <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
           </listener>
           <!-- session超時定義,單位為分鐘 -->
           <session-config>
            <session-timeout>10</session-timeout>
           </session-config>
           <!-- The Welcome File List -->
           <welcome-file-list>
            <welcome-file>index.html</welcome-file>
           </welcome-file-list>
          </web-app>

          posted @ 2008-12-08 11:18 Robert Su 閱讀(239) | 評論 (0)編輯 收藏

          僅列出標題
          共11頁: First 上一頁 3 4 5 6 7 8 9 10 11 下一頁 

          posts - 103, comments - 104, trackbacks - 0, articles - 5

          Copyright © Robert Su

          主站蜘蛛池模板: 靖远县| 龙井市| 武夷山市| 平武县| 阿尔山市| 华坪县| 仲巴县| 龙胜| 保亭| 镇康县| 淳化县| 新巴尔虎左旗| 鄂州市| 临湘市| 文登市| 泰顺县| 津南区| 阿图什市| 尼勒克县| 通江县| 即墨市| 南皮县| 库车县| 永春县| 肥乡县| 甘泉县| 桦南县| 梓潼县| 阿坝| 光山县| 沾益县| 阜城县| 莱州市| 上林县| 柞水县| 广河县| 新疆| 济阳县| 封丘县| 贵阳市| 陆河县|