簡易代碼之家

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            157 Posts :: 2 Stories :: 57 Comments :: 0 Trackbacks

          #

          錯誤提示:三個“未知”;
          解決方法:找到oracle的安裝文件下的install目錄,右鍵點擊setup.exe,選擇 屬性 -> 兼容性,然后在兼容模式下打勾,選擇Windows Server 2003 (Service Pack 1),再選擇以管理員身份運行此程序即可。
          posted @ 2010-05-10 16:42 Jakin.zhou 閱讀(1318) | 評論 (1)編輯 收藏

           

          <head>
          <meta HTTP-EQUIV=refresh Content='0;url=http://www.baidu.com'>
          </head>
          <body>
          </body>
          posted @ 2010-03-11 10:49 Jakin.zhou 閱讀(2179) | 評論 (0)編輯 收藏

          <%@ taglib prefix = "fn" uri = "http://java.sun.com/jsp/jstl/functions" %>  

          fn:contains 判定字符串是否包含另外一個字符串 < c:if test = "${fn:contains(name, searchString)}" >  
          fn:containsIgnoreCase 判定字符串是否包含另外一個字符串(大小寫無關) < c:if test = "${fn:containsIgnoreCase(name, searchString)}" >  
          fn:endsWith 判定字符串是否以另外字符串結束 < c:if test = "${fn:endsWith(filename, " .txt")}" >  
          fn:escapeXml 把一些字符轉成XML表示,例如 < 字符應該轉為 < ${fn:escapeXml(param:info)}  
          fn:indexOf 子字符串在母字符串中出現的位置 ${fn:indexOf(name, "-")}  
          fn:join 將數組中的數據聯合成一個新字符串,并使用指定字符格開 ${fn:join(array, ";")}  
          fn:length 獲取字符串的長度,或者數組的大小 ${fn:length(shoppingCart.products)}  
          fn:replac e 替換字符串中指定的字符 ${fn:replace(text, "-", "?")}  
          fn:split 把字符串按照指定字符切分 ${fn:split(customerNames, ";")}  
          fn:startsWith 判定字符串是否以某個子串開始 < c:if test ="${fn:startsWith(product.id, " 100 -")}" >  
          fn:substring 獲取子串 ${fn:substring(zip, 6, -1)}  
          fn:substringAfter 獲取從某個字符所在位置開始的子串  
          ${fn:substringAfter(zip, "-")}  
          fn:substringBefore 獲取從開始到某個字符所在位置的子串 ${fn:substringBefore(zip, "-")}  
          fn:toLowerCase 轉為小寫 ${fn.toLowerCase(product.name)}  
          fn:toUpperCase 轉為大寫字符 ${fn.UpperCase(product.name)}  
          fn:trim 去除字符串前后的空格 ${fn.trim(name)}  

              
          描述  
           
          fn:contains(string, substring)  
          假如參數string中包含參數substring,返回true  
           
          fn:containsIgnoreCase(string, substring)  
          假如參數string中包含參數substring(忽略大小寫),返回true  
           
          fn:endsWith(string, suffix)  
          假如參數 string 以參數suffix結尾,返回true  
           
          fn:escapeXml(string)  
          將有非凡意義的XML (和HTML)轉換為對應的XML character entity code,并返回  
           
          fn:indexOf(string, substring)  
          返回參數substring在參數string中第一次出現的位置  
           
          fn:join(array, separator)  
          將一個給定的數組array用給定的間隔符separator串在一起,組成一個新的字符串并返回。  
           
          fn:length(item)  
          返回參數item中包含元素的數量。參數Item類型是數組、collection或者String。假如是String類型,返回值是String中的字符數。  
           
          fn:replace(string, before, after)  
          返回一個String對象。用參數after字符串替換參數string中所有出現參數before字符串的地方,并返回替換后的結果  
           
          fn:split(string, separator)  
          返回一個數組,以參數separator 為分割符分割參數string,分割后的每一部分就是數組的一個元素  
           
          fn:startsWith(string, prefix)  
          假如參數string以參數prefix開頭,返回true  
           
          fn:substring(string, begin, end)  
          返回參數string部分字符串, 從參數begin開始到參數end位置,包括end位置的字符  
           
          fn:substringAfter(string, substring)  
          返回參數substring在參數string中后面的那一部分字符串  
           
          fn:substringBefore(string, substring)  
          返回參數substring在參數string中前面的那一部分字符串  
           
          fn:toLowerCase(string)  
          將參數string所有的字符變為小寫,并將其返回  
           
          fn:toUpperCase(string)  
          將參數string所有的字符變為大寫,并將其返回  
           
          fn:trim(string)  
          去除參數string 首尾的空格,并將其返回

          posted @ 2010-01-27 14:14 Jakin.zhou 閱讀(474) | 評論 (0)編輯 收藏

          public static void main(String[] args) {
                  NumberFormat nf 
          = NumberFormat.getPercentInstance();
                  nf.setMinimumFractionDigits(
          2); // 設置兩位小數位
                  double result = (double1 / 32;
                  System.out.println(nf.format(result));
              }

          運行結果:3.12%
          posted @ 2010-01-21 16:26 Jakin.zhou 閱讀(1292) | 評論 (0)編輯 收藏

          數據表結構及數據:


          要統計的報表格式:


          SQL語句:

          1.只統計最右邊的合計人數:
          select t.addr,
                sum( case when(t.type='0') then 1 else 0 end ) as "甲流人數",
                sum( case when(t.type='1') then 1 else 0 end ) as "流感人數",
                sum( case when(t.type='2') then 1 else 0 end ) as "它病人數",
                count(*) as "合計人數"
          from test t
          group by t.addr;
          2.最右邊和下邊的合計都統計:
          (select t.addr as "區域",
                sum( case when(t.type='0') then 1 else 0 end ) as "甲流人數",
                sum( case when(t.type='1') then 1 else 0 end ) as "流感人數",
                sum( case when(t.type='2') then 1 else 0 end ) as "它病戶數",
                count(*) as "合計人數"
          from test t
          group by t.addr)
          union
          (select null, sum( case when(t.type='0') then 1 else 0 end ),
                sum( case when(t.type='1') then 1 else 0 end ),
                sum( case when(t.type='2') then 1 else 0 end ),
                count(*)
          from test t);

           

          posted @ 2009-11-13 15:12 Jakin.zhou 閱讀(470) | 評論 (0)編輯 收藏

               今天遇到一個問題:由myeclipse7.5導出項目war包,放在服務器上運行時總是出錯,可在本機上可以運行。查看console,顯示Bad version...,原來是編譯環境和運行環境不同,編譯版本jdk為1.6,而運行環境jdk為1.5。高版本的jdk編譯的.class文件在低版本jdk中不能運行。解決辦法:調整開發環境,使用jdk1.5,在myeclipse中Window-Preferences-Java-Compiler修改。
          posted @ 2009-09-23 15:01 Jakin.zhou 閱讀(128) | 評論 (0)編輯 收藏

               摘要: validateCode.jsp: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath&n...  閱讀全文
          posted @ 2009-09-22 19:45 Jakin.zhou 閱讀(193) | 評論 (0)編輯 收藏

          js代碼:
          function setIframeHeight() {
              
          var dHeight = 502//基礎高度
              var main = document.getElementById("mainIframe");
              
          var left = document.getElementById("leftIframe");
              
          //var leftFrame = document.getElementsByName("left")[0];
              var cHeight = main.contentWindow.document.body.scrollHeight; //當前高度
              var sHeight = 0//準備設置的高度值
              if (cHeight <= dHeight) {
                  sHeight 
          = dHeight + "px";
              } 
          else {
                  sHeight 
          = cHeight + "px";
              }
              main.style.height 
          = sHeight;
              left.style.height 
          = sHeight;
              
          if (left.contentWindow.document.getElementById("leftFrameCont")) {
                  left.contentWindow.document.getElementById(
          "leftFrameCont").style.height = sHeight;
              }
          }
          index.jsp部分頁面代碼:
          <div id="content_bottom2" style="width:auto;">
              
          <iframe name="left" class="vipIf_left" scrolling="no" marginwidth="0px" frameborder="0" src="left.jsp" id="leftIframe"></iframe>
              
          <iframe name="main" class="vipIf_right" frameborder="0" src="main.jsp" onload="setIframeHeight();" id="mainIframe"></iframe>
          </div>

          left.jsp部分頁面代碼:
          <body>
              
          <div class="cont_left" id="leftFrameCont">
                  

              
          </div>
          </body>
          posted @ 2009-09-21 15:13 Jakin.zhou 閱讀(1321) | 評論 (0)編輯 收藏

          比如我們要在List<Object> list = new ArrayList<Object>()中根據條件刪除若干個元素。
          方式一:

          for(int i = 0;i<list.size();i++){
                      
          if(list.get(i).toString().equals("Test")){
                          list.remove(i);
                      }

                  }
          這種方式由于list的size一直在變,刪除動作也受到影響,方式二可改變此問題。
          方式二:
          for(int i = list.size()-1;i>-1;i--){
                      
          if(list.get(i).toString().equals("Test")){
                          list.remove(i);
                      }

                  }
          posted @ 2009-09-21 12:39 Jakin.zhou 閱讀(161) | 評論 (0)編輯 收藏

          效果如圖:

          代碼如下:
           1<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
           2<html xmlns="http://www.w3.org/1999/xhtml">
           3    <head>
           4        <meta http-equiv="Content-Type" content="text/html;   charset=gb2312" />
           5        <title>多選框傳值</title>
           6        <script type="text/javascript">   
           7          function toRight(){   
           8              var sel1 = document.getElementById("s1");   
           9              var sel2 = document.getElementById("s2");
          10              for(i=0;i<sel1.length;i++){
          11                if(sel1.options[i].selected){
          12                  var target = true;
          13                  for(var j=0;j<sel2.length;j++){
          14                    if(sel1.options[i].text==sel2.options[j].text){
          15                        target = false;
          16                        break;
          17                    }

          18                  }

          19                  if(target){
          20                      var oOption = document.createElement("option");
          21                      sel2.options.add(oOption,parseInt(sel1.options[i].value));   
          22                      oOption.text = sel1.options[i].text;   
          23                      oOption.selected = false
          24                  }

          25                }

          26              }

          27          }

          28          function toLeft(){   
          29              var sel2 = document.getElementById("s2");
          30              for(i=sel2.length-1;i>-1;i--){
          31                if(sel2.options[i].selected){
          32                    sel2.remove(i);
          33                }

          34              }

          35          }
             
          36          
          </script>
          37    </head>
          38    <body>
          39        <table>
          40            <tr>
          41                <td>
          42                    <select id="s1" multiple="multiple"
          43                        style="width: 100px; height: 100px">
          44                        <option value="1">
          45                            o1Text
          46                        </option>
          47                        <option value="2">
          48                            o2Text
          49                        </option>
          50                        <option value="3">
          51                            o3Text
          52                        </option>
          53                        <option value="4">
          54                            o4Text
          55                        </option>
          56                        <option value="5">
          57                            o5Text
          58                        </option>
          59                    </select>
          60                </td>
          61                <td>
          62                    <input type="button" value=">" onclick="toRight();">
          63                    <br />
          64                    <input type="button" value="<" onclick="toLeft();">
          65                </td>
          66                <td>
          67                    <select id="s2" multiple="multiple"
          68                        style="width: 100px; height: 100px">
          69                    </select>
          70                </td>
          71            </tr>
          72        </table>
          73    </body>
          74</html>
          75
          posted @ 2009-09-21 12:22 Jakin.zhou 閱讀(271) | 評論 (0)編輯 收藏

          僅列出標題
          共16頁: First 上一頁 8 9 10 11 12 13 14 15 16 下一頁 
          主站蜘蛛池模板: 桂东县| 威远县| 泸水县| 惠州市| 克东县| 罗定市| 洛隆县| 洛浦县| 阿勒泰市| 喀喇| 墨竹工卡县| 尼勒克县| 巴青县| 万源市| 苍山县| 葫芦岛市| 根河市| 宜州市| 衢州市| 额敏县| 德化县| 阜康市| 泰安市| 仁化县| 屯留县| 全椒县| 常德市| 庄浪县| 黄骅市| 神池县| 江陵县| 贵州省| 西吉县| 航空| 永清县| 扎囊县| 亚东县| 河源市| 利津县| 五原县| 河间市|