當幸福來敲門

          我就會牢牢抓??!
          隨筆 - 50, 文章 - 3, 評論 - 8, 引用 - 0
          數據加載中……

          orcle修改屬性字段 并且保留原有值

          1.原字段類型是字符串 使用“||”連接
          update table1 set num = substr(num,0,instr(num,'-'))||(substr(num,instr(num,'-')+1) +9) 
          2.原字段是數字 使用+連接
          UPDATE table1SET num = num+10 
          3.截取 update tc_report t set xlsfile=substr(xlsfile,6) where xlsfile like '%uku\%'

          posted @ 2012-11-12 10:20 wyx 閱讀(337) | 評論 (0)編輯 收藏

          form表單 修改 多選框默認選中

          1.放到HashMap中
            String varsort=exp.getVarsort();
             String vars[]=null;
             HashSet setvar = new HashSet();
             if(varsort!=null&&!varsort.trim().equals("")){
              vars=varsort.substring(0,varsort.length()-1).split(",");
              for(int i=0;i<vars.length;i++){
               setvar.add(vars[i].trim());
              }
             }
          2. contains比較是否包含
          <% if(varsorts!=null&&varsorts.size()>0){
                     for(int j=0;j<varsorts.size();j++){
                      TDictionarys td=varsorts.get(j);
                      %>
                   <input type="checkbox" value="<%=td.getDataid() %>" <%if(setvar.contains(String.valueOf(td.getDataid()).trim())){out.print("checked");} %> onclick="getBreeds()" name="varsort" id="varsort" />
                   <label for="checkbox" class="font12">
                   <%=td.getName() %>
                      </label>
                      <%
                     }
                    }
                   %>
                  

          posted @ 2012-09-21 18:03 wyx 閱讀(1330) | 評論 (1)編輯 收藏

          頁面級緩存處理

          前提  列表走了數據庫查詢
          1.引入架包  <%@ taglib uri="oscache" prefix="cache"%>
          2.包含要緩存的部分
          <cache:cache key="dbnewscache" time="3600">  
                  <%List<Article> list=new CmsByMysql().getNews(); %>
                    <c:forEach var="cu" items="<%=list%>">
                         <li>
                    <a href="${cu.url}">${cu.titleContent} </a>
                      </li>
                    </c:forEach>
          </cache:cache>

          posted @ 2012-09-21 17:25 wyx 閱讀(229) | 評論 (0)編輯 收藏

          Ifram 父子頁面 JS調用

          <iframe marginwidth="0" framespacing="0" marginheight="0" frameborder="0"
          name="uploadframe" id="uploadframe" src="c.html" scrolling="no" width="100" height="100" ></iframe>
          如想在c.html 中寫一些代碼去改變parent.html 中的一些內容,以下代碼可作為參考:

          1、parent.window.frames 可返回parent.html 中所有的iframe;返回結果應該是一個數組,用parent.window.frames[iframeId]可得到iframeId;

          2、用parent.document.getElementById('xxxx')可得到父里的xxxx,并改變相應的值,例如:parent.document.getElementById('xxxx').className = 'test';

          3、如果我想在父中再創建一個元素,直接用parent.appendChild(yyyy)在firefox中是可以的,但在IE(最起碼IE6)是不行的; 所以,要把創建這個動作放在父中來完成,在子中調用;

           parent.document.getElementById("pinming").innerHTML = retText2;

          posted @ 2012-07-24 15:29 wyx 閱讀(717) | 評論 (0)編輯 收藏

          jquery目錄樹 js實現 目錄數插件

          2011-07-13 10:07

          jQuery 目錄樹插件介紹——ligerTree

           

           

          一,簡介 

          ligerTree的功能列表:

          1,支持本地數據和服務器數據(配置data或者url)

          2,支持原生html生成Tree

          3,支持動態獲取增加/修改/刪除節點

          4,支持大部分常見的事件

          5,支持獲取選中行等常見的接口方法

           

          二,第一個例子

          引入庫文件

          遵循LigerUI系列插件的設計原則(插件盡量單獨),ligerTree是一個單獨的插件,也就是說只需要引入plugins/ligerTree.js和樣式css文件就可以使用(當然必須先引入jQuery),在這個例子中,我把tree用到的樣式和圖片分離了出來,有興趣的朋友可以下載來看看

            

          <script src="lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
          <link href="lib/ligerUI/skins/Aqua/css/ligerui-tree.css" rel="stylesheet" type="text/css"/>
          <script src="lib/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script>

          加入HTML

            

          <ul id="tree1">
          <li>
          <span>節點1</span>
          <ul>
          <li>
          <span>節點1.1</span>
          <ul>
          <li><span>節點1.1.1</span></li>
          <li><span>節點1.1.2</span></li>
          </ul>
          </li>
          <li><span>節點1.2</span></li>
          </ul>
          </li>
          </ul>

          調用ligerTree

          <table style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-style: initial !important; border-color: initial !important; outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 1em !important; min-height: inherit !important; border-collapse: collapse !important; background-position: initial initial !important; background-repeat: initial initial !important; "><td style="font-size: 1em !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0.5em !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: initial !important; border-style: initial !important; border-color: initial !important; outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: top !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; min-height: inherit !important; border-left-style: none !important; border-left-color: initial !important; color: rgb(0, 0, 0) !important; background-position: initial initial !important; background-repeat: initial initial !important; ">$("#tree1").ligerTree();

          效果圖

          三,常用場景

          場景一:不使用復選框: 

          $("#tree2").ligerTree({ checkbox: false });

          場景二:不使用復習框和圖標: 

          $("#tree3").ligerTree({ checkbox: false, parentIcon: null, childIcon: null });

          效果如圖:

          ?

          append(parentNode, newdata)增加節點集合clear()清空collapseAll()全部節點都折疊demotion(treenode)降級為葉節點級別expandAll()全部節點都展開getChecked()獲取選擇的行(復選框)getData()獲取樹的數據源getParentTreeItem(treenode, level)獲取父節點getSelected()獲取選擇的行hasChildren(treenode)是否包含子節點 loadData(node, url, param)加載數據remove(node)刪除節點upgrade(treenode)升級為父節點級別

          posted @ 2012-07-04 16:59 wyx 閱讀(2100) | 評論 (1)編輯 收藏

          讀取 文本 文件內容 FileInputStream 亂碼處理

            StringBuffer content = new StringBuffer();
          //  FileInputStream fis = null;
          //  byte[] b = new byte[2048];
          //  try {
          //    if(lang!=null&&lang.trim().equals("10")){
          //     fis = new FileInputStream(passwordTemplatePath);
          //     }else if(lang!=null&&lang.trim().equals("20")){
          //      fis = new FileInputStream(passwordTemplateEnPath);
          //     }else if(lang!=null&&lang.trim().equals("30")){
          //      fis = new FileInputStream(passwordTemplateChinaEnPath);
          //     }
          //     int m = 0;
          //   while ((m = fis.read(b)) != -1) {
          //    content.append(new String(b, 0, m));
          //   }
          //passwordTemplatePath 文本 文件地址
            BufferedReader br = null;
            try {
              if(lang!=null&&lang.trim().equals("10")){
                   br =  new BufferedReader(new InputStreamReader(new FileInputStream(passwordTemplatePath), "utf-8"));
                }else if(lang!=null&&lang.trim().equals("20")){
                 br =  new BufferedReader(new InputStreamReader(new FileInputStream(passwordTemplateEnPath), "utf-8"));
               }else if(lang!=null&&lang.trim().equals("30")){
                  br =  new BufferedReader(new InputStreamReader(new FileInputStream(passwordTemplateChinaEnPath), "utf-8"));
                }
              String s = null;
              while ((s = br.readLine()) != null) {
              content.append(s);
             }
            } catch (Exception e) {
             e.printStackTrace();
            } finally {
             try {
              br.close();
             } catch (IOException e) {
              e.printStackTrace();
             }
            }

          posted @ 2012-06-26 17:15 wyx 閱讀(2123) | 評論 (2)編輯 收藏

          線程等待問題處理

          class MyThread implements Runnable {
          @Override
          public void run() {
            System.out.println("1、進入run()方法休眠");
            try {
             System.out.println("2、線程休眠20秒");
             Thread.sleep(20000);//這里休眠20秒
             System.out.println("3、線程正常休眠完畢");
            } catch (InterruptedException e) {
             System.out.println("4、線程發生異常休眠被中斷");
             return;//返回方法調用處
            }
            System.out.println("5、線程正常結束run()方法體");
          }
          }
          public class InterruptDemo {

          public static void main(String[] args) {
            MyThread mt = new MyThread();
            Thread t = new Thread(mt,"線程A");
            t.start();//啟動線程
          //========================================================
            try {
             Thread.sleep(2000);  //保證線程至少執行2秒
            } catch (InterruptedException e) {
             e.printStackTrace();
            }
          //========================================================
            t.interrupt();//中斷線程
          }
          }

          posted @ 2012-06-21 15:21 wyx 閱讀(207) | 評論 (0)編輯 收藏

          "Mon Dec 28 00:00:00 CST 2008"的格式字符串轉換 yyyy-MM-dd 格式

          public static void main(String[] args)
           {
             try {
                java.util.Date date;
                // 首先設置"Mon Dec 28 00:00:00 CST 2008"的格式,用來將其轉化為Date對象
                DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);

                //將已有的時間字符串轉化為Date對象
                date = df.parse("Tue Jun 19 00:00:00 CST 2012");// 那天是周一
                // 創建所需的格式
                df = new SimpleDateFormat("yyyy-MM-dd");
                String str = df.format(date);// 獲得格式化后的日期字符串
                System.err.println(str);// 打印最終結果
               } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
               }


           }

          posted @ 2012-06-19 16:12 wyx 閱讀(6996) | 評論 (1)編輯 收藏

          JAVA開發者最常去的25個英文網站 (轉載http://handawei.iteye.com/blog/675034)

        1. http://www.infoq.com/ - Info IT新聞
        2. http://www.apache.org/ - Apache基金會
        3. http://www.springsource.org/ - 廣大Java開發者喜愛的Spring
        4. http://www.hibernate.org/ - 開源ORM框架
        5. http://sourceforge.net/ - 開源技術的集結地
        6. http://www.javaalmanac.com – Java開發者年鑒一書的在線版本. 要想快速查到某種Java技巧的用法及示例代碼, 這是一個不錯的去處.
        7. http://www.onjava.com – O’Reilly的Java網站. 每周都有新文章.
        8. http://java.sun.com – 官方的Java開發者網站 – 每周都有新文章發表.
        9. http://www.developer.com/java – 由Gamelan.com 維護的Java技術文章網站.
        10. http://www.java.net – Sun公司維護的一個Java社區網站.
        11. http://www.builder.com – Cnet的Builder.com網站 – 所有的技術文章, 以Java為主.
        12. http://www.ibm.com/developerworks/java – IBM的Developerworks技術網站; 這是其中的Java技術主頁.
        13. http://www.javaworld.com – 最早的一個Java站點. 每周更新Java技術文章.
        14. http://www.devx.com/java – DevX維護的一個Java技術文章網站.
        15. http://www.fawcette.com/javapro – JavaPro在線雜志網站.
        16. http://www.sys-con.com/java – Java Developers Journal的在線雜志網站.
        17. http://www.javadesktop.org – 位于Java.net的一個Java桌面技術社區網站.
        18. http://www.theserverside.com – 這是一個討論所有Java服務器端技術的網站.
        19. http://www.jars.com – 提供Java評論服務. 包括各種framework和應用程序.
        20. http://www.jguru.com – 一個非常棒的采用Q&A形式的Java技術資源社區.
        21. http://www.javaranch.com – 一個論壇,得到Java問題答案的地方,初學者的好去處。
        22. http://www.ibiblio.org/javafaq/javafaq.html – comp.lang.java的FAQ站點 – 收集了來自comp.lang.java新聞組的問題和答案的分類目錄.
        23. http://java.sun.com/docs/books/tutorial/ – 來自SUN公司的官方Java指南 – 對于了解幾乎所有的java技術特性非常有幫助.
        24. http://www.javablogs.com – 互聯網上最活躍的一個Java Blog網站.
        25. http://java.about.com/ – 來自About.com的Java新聞和技術文章網站.
        26. posted @ 2012-06-15 15:44 wyx 閱讀(207) | 評論 (0)編輯 收藏

          EL表達式處理字符串 是否 包含 某字符串 截取 拆分...............

          JSP頁面頁頭添加
          <%@ taglib uri="/WEB-INF/taglib/c.tld" prefix="c"%>
          <%@ taglib prefix="fn" uri="頁面內容如下: 

          <c:if test="${fn:contains(record.name,'樣例')==false}">
                                           <%
                   if ((f != null && f.trim().equals("0"))&&name!=null&&!name.trim().equals("免費報告")) {
                  %><a
                   href="javascript:void(0);alert('很抱歉,您無權訪問!如需訪問請購買產品或聯系管理員...');">
                   ${record.name} </a>
                  <%
                   } else {
                  %>
                  <a
                   href="/tcreportAction.do?method=lookReportInfo&bid=${record.bid } ">${record.name}</a>
                  <%
                   }
                  %>
                   </c:if>
                     <c:if test="${fn:contains(record.name,'樣例')}">
                                             <a
                   href="/tcreportAction.do?method=lookReportInfo&bid=${record.bid } ">${record.name}</a>
                 
                                           </c:if>



          ${wjcd.lrsj}原來得到的是如2006-11-12 11:22:22.0

          ${fn:substring(wjcd.lrsj, 0, 16)}

          使用functions函數來獲取list的長度

          ${fn:length(list)}

           

           

           

          1. fn:contains(string, substring)   
          2. 假如參數string中包含參數substring,返回true   
          3.   
          4. fn:containsIgnoreCase(string, substring)   
          5. 假如參數string中包含參數substring(忽略大小寫),返回true   
          6.   
          7. fn:endsWith(string, suffix)   
          8. 假如參數 string 以參數suffix結尾,返回true   
          9.   
          10. fn:escapeXml(string)   
          11. 將有非凡意義的XML (和HTML)轉換為對應的XML character entity code,并返回   
          12.   
          13. fn:indexOf(string, substring)   
          14. 返回參數substring在參數string中第一次出現的位置   
          15.   
          16. fn:join(array, separator)   
          17. 將一個給定的數組array用給定的間隔符separator串在一起,組成一個新的字符串并返回。   
          18.   
          19. fn:length(item)   
          20. 返回參數item中包含元素的數量。參數Item類型是數組、collection或者String。假如是String類型,返回值是String中的字符數。   
          21.   
          22. fn:replace(string, before, after)   
          23. 返回一個String對象。用參數after字符串替換參數string中所有出現參數before字符串的地方,并返回替換后的結果   
          24.   
          25. fn:split(string, separator)   
          26. 返回一個數組,以參數separator 為分割符分割參數string,分割后的每一部分就是數組的一個元素   
          27.   
          28. fn:startsWith(string, prefix)   
          29. 假如參數string以參數prefix開頭,返回true   
          30.   
          31. fn:substring(string, begin, end)   
          32. 返回參數string部分字符串, 從參數begin開始到參數end位置,包括end位置的字符   
          33.   
          34. fn:substringAfter(string, substring)   
          35. 返回參數substring在參數string中后面的那一部分字符串   
          36.   
          37. fn:substringBefore(string, substring)   
          38. 返回參數substring在參數string中前面的那一部分字符串   
          39.   
          40. fn:toLowerCase(string)   
          41. 將參數string所有的字符變為小寫,并將其返回   
          42.   
          43. fn:toUpperCase(string)   
          44. 將參數string所有的字符變為大寫,并將其返回   
          45.   
          46. fn:trim(string)   
          47. 去除參數string 首尾的空格,并將其返回 


          截取字符串!使用!

           
          <c:if test="${fn:length(onebeans.info)>100 }">${ fn:substring( onebeans.info ,0,100)} ...</c:if>
           <c:if test="${fn:length(onebeans.info)<=100 }">${  onebeans.info }</c:if>


          posted @ 2012-06-14 14:38 wyx 閱讀(29481) | 評論 (0)編輯 收藏

          僅列出標題
          共5頁: 上一頁 1 2 3 4 5 下一頁 
          主站蜘蛛池模板: 土默特左旗| 松桃| 武城县| 正宁县| 曲阳县| 新密市| 大洼县| 随州市| 永靖县| 恭城| 平罗县| 宁晋县| 阿城市| 绥化市| 景洪市| 长沙市| 化隆| 开江县| 龙门县| 梅河口市| 苏尼特左旗| 高平市| 融水| 炎陵县| 西贡区| 襄樊市| 拜城县| 闽侯县| 西乡县| 肥东县| 靖边县| 锦州市| 大英县| 辉南县| 永安市| 诏安县| 荣成市| 子长县| 宜兰县| 太白县| 房产|