<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    自由飛翔

    我在仰望,java之上

    統(tǒng)計(jì)

    留言簿(2)

    我關(guān)注的blog

    閱讀排行榜

    評(píng)論排行榜

    #

    文件操作

    一、刪除文件或刪除文件目錄
    參考文章來(lái)源:http://www.examw.com/java/jichu/142150/ 

     import java.io.File;

      public class DeleteFileUtil {

      /**

      * 刪除文件,可以是單個(gè)文件或文件夾

      * @param   fileName    待刪除的文件名

      * @return 文件刪除成功返回true,否則返回false

      */

      public static boolean delete(String fileName){

      File file = new File(fileName);

      if(!file.exists()){

      System.out.println("刪除文件失敗:"+fileName+"文件不存在");

      return false;

      }else{

      if(file.isFile()){

      return deleteFile(fileName);

      }else{

      return deleteDirectory(fileName);

      }

      }

      }

      /**

      * 刪除單個(gè)文件

      * @param   fileName    被刪除文件的文件名

      * @return 單個(gè)文件刪除成功返回true,否則返回false

      */

      public static boolean deleteFile(String fileName){

      File file = new File(fileName);

      if(file.isFile() && file.exists()){

      file.delete();

      System.out.println("刪除單個(gè)文件"+fileName+"成功!");

      return true;

      }else{

      System.out.println("刪除單個(gè)文件"+fileName+"失??!");

      return false;

      }

      }

      /**

      * 刪除目錄(文件夾)以及目錄下的文件

      * @param   dir 被刪除目錄的文件路徑

      * @return  目錄刪除成功返回true,否則返回false

      */

      public static boolean deleteDirectory(String dir){

      //如果dir不以文件分隔符結(jié)尾,自動(dòng)添加文件分隔符

      if(!dir.endsWith(File.separator)){

      dir = dir+File.separator;

      }

      File dirFile = new File(dir);

      //如果dir對(duì)應(yīng)的文件不存在,或者不是一個(gè)目錄,則退出

      if(!dirFile.exists() || !dirFile.isDirectory()){

      System.out.println("刪除目錄失敗"+dir+"目錄不存在!");

      return false;

      }

      boolean flag = true;

      //刪除文件夾下的所有文件(包括子目錄)

      File[] files = dirFile.listFiles();

      for(int i=0;i<files.length;i++){

      //刪除子文件

      if(files[i].isFile()){

      flag = deleteFile(files[i].getAbsolutePath());

      if(!flag){

      break;

      }

      }

      //刪除子目錄

      else{

      flag = deleteDirectory(files[i].getAbsolutePath());

      if(!flag){

      break;

      }

      }

      }

      if(!flag){

      System.out.println("刪除目錄失敗");

      return false;

      }

      //刪除當(dāng)前目錄

      if(dirFile.delete()){

      System.out.println("刪除目錄"+dir+"成功!");

      return true;

      }else{

      System.out.println("刪除目錄"+dir+"失敗!");

      return false;

      }

      }

      public static void main(String[] args) {

      //String fileName = "g:/temp/xwz.txt";

      //DeleteFileUtil.deleteFile(fileName);

      String fileDir = "G:/temp/temp0/temp1";

      //DeleteFileUtil.deleteDirectory(fileDir);

      DeleteFileUtil.delete(fileDir);

      }

      }
    二、列出目錄或文件
    三、讀取文本

    后續(xù),晚了,先睡了....

    posted @ 2011-08-22 02:47 GavinMiao 閱讀(320) | 評(píng)論 (2)編輯 收藏

    jsp相對(duì)路徑和絕對(duì)路徑

    一、
    1、<base>標(biāo)簽的作用:
    為頁(yè)面上的所有鏈接規(guī)定默認(rèn)地址或默認(rèn)目標(biāo)。
    2、<base>標(biāo)簽的兩個(gè)屬性,target:在何處打開頁(yè)面中所有的鏈接;href:規(guī)定頁(yè)面中所有相對(duì)鏈接的基準(zhǔn) URL。
    3、例子:
    1)
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <base href="<%=basePath%>">

    jsp頁(yè)面顯示:
    basePath:
    http://localhost:8080/testProject/
    2)
    <% String realPath = application.getRealPath("/"); %>

    jsp頁(yè)面顯示:
    realPath:
    D:\tomcat\webapps\testProject\
    3)
    ${request.contextPath}
    jsp頁(yè)面顯示:
    contextPath:
    /testProject
    4)
    如果請(qǐng)求是http://localhost:8080/testProject/page/test.jsp;

    <%=request.getRequestURI() %>
    jsp頁(yè)面顯示:
    requestURI:
    /testProject/page/test.jsp
    二、
    1、文件分隔符:unix系統(tǒng):“/”,windows系統(tǒng):“\”;
    System.getProperty("file.separator")
    2、路徑分隔符:unix系統(tǒng):“:”,windows系統(tǒng):“;”;
    System.getProperty("path.separator");
    三、
    1. <%=Thread.currentThread().getContextClassLoader().getResource("") %>
    jsp頁(yè)面顯示:
    file:/D:/tomcat/webapps/testProject/WEB-INF/classes/

    posted @ 2011-08-22 02:29 GavinMiao 閱讀(5404) | 評(píng)論 (0)編輯 收藏

    html相對(duì)路徑和絕對(duì)路徑

    文章來(lái)源 :http://blog.csdn.net/teedry/article/details/5190371


    HTML相對(duì)路徑與絕對(duì)路徑

        在網(wǎng)頁(yè)制作的過(guò)程中,少不了跟路徑打交道,比如,包含一個(gè)文件,插入一個(gè)圖片等,與路徑都有關(guān)系,如果使用了錯(cuò)誤的文件路徑,就會(huì)導(dǎo)致引用失效(無(wú)法瀏覽鏈接文件,或無(wú)法顯示插入的圖片等)。初學(xué)者可能會(huì)感到困惑,下面我就詳細(xì)的介紹一下相對(duì)路徑與絕對(duì)路徑。

    HTML有2種路徑的寫法:相對(duì)路徑和絕對(duì)路徑。

    1.HTML相對(duì)路徑(Relative Path)
    同一個(gè)目錄的文件引用
    如果源文件和引用文件在同一個(gè)目錄里,直接寫引用文件名即可,這時(shí)引用文件的方式就是使用相對(duì)路徑。

    我們現(xiàn)在建一個(gè)源文件info.html,在info.html里要引用index.html文件作為超鏈接。

    假設(shè)info.html路徑是:c:/Inetpub/wwwroot/sites/blabla/info.html
    假設(shè)index.html路徑是:c:/Inetpub/wwwroot/sites/blabla/index.html
    在info.html加入index.html超鏈接的代碼應(yīng)該這樣寫:

    <a href = "index.html">這是超連接</a>
    如何表示上級(jí)目錄
    ../表示源文件所在目錄的上一級(jí)目錄,../../表示源文件所在目錄的上上級(jí)目錄,以此類推。

    假設(shè)info.html路徑是:c:/Inetpub/wwwroot/sites/blabla/info.html
    假設(shè)index.html路徑是:c:/Inetpub/wwwroot/sites/index.html
    在info.html加入index.html超鏈接的代碼應(yīng)該這樣寫:

    <a href = "../index.html">這是超連接</a>

    假設(shè)info.html路徑是:c:/Inetpub/wwwroot/sites/blabla/info.html
    假設(shè)index.html路徑是:c:/Inetpub/wwwroot/index.html
    在info.html加入index.html超鏈接的代碼應(yīng)該這樣寫:


    <a href = "../../index.html">index.html</a>
    假設(shè)info.html路徑是:c:/Inetpub/wwwroot/sites/blabla/info.html
    假設(shè)index.html路徑是:c:/Inetpub/wwwroot/sites/wowstory/index.html
    在info.html加入index.html超鏈接的代碼應(yīng)該這樣寫:


    <a href = "../wowstory/index.html">index.html</a>
    如何表示下級(jí)目錄
    引用下級(jí)目錄的文件,直接寫下級(jí)目錄文件的路徑即可。

    假設(shè)info.html路徑是:c:/Inetpub/wwwroot/sites/blabla/info.html
    假設(shè)index.html路徑是:c:/Inetpub/wwwroot/sites/blabla/html/index.html
    在info.html加入index.html超鏈接的代碼應(yīng)該這樣寫:


    <a href = "html/index.html">這是超連接</a>
    假設(shè)info.html路徑是:c:/Inetpub/wwwroot/sites/blabla/info.html
    假設(shè)index.html路徑是:c:/Inetpub/wwwroot/sites/blabla/html/tutorials/index.html
    在info.html加入index.html超鏈接的代碼應(yīng)該這樣寫:


    <a href = "html/tutorials/index.html">這是超連接</a>
    2.HTML絕對(duì)路徑(Absolute Path)
    大 家都知道,在我們平時(shí)使用計(jì)算機(jī)時(shí)要找到需要的文件就必須知道文件的位置,而表示文件的位置的方式就是路徑,例如只要看到這個(gè)路徑:c:/website /img/photo.jpg我們就知道photo.jpg文件是在c盤的website目錄下的img子目錄中。類似于這樣完整的描述文件位置的路徑就 是絕對(duì)路徑。我們不需要知道其他任何信息就可以根據(jù)絕對(duì)路徑判斷出文件的位置。而在網(wǎng)站中類似以http://www.ajaxstu.com/img/photo.jpg來(lái)確定文件位置的方式也是絕對(duì)路徑。


    HTML絕對(duì)路徑(absolute path)在網(wǎng)頁(yè)制作中指帶域名的文件的完整路徑。

    假設(shè)你注冊(cè)了域名http://www.ajaxstu.com,并申請(qǐng)了虛擬主機(jī),你的虛擬主機(jī)提供商會(huì)給你一個(gè)目錄,比如www,這個(gè)www就是你網(wǎng)站的根目錄。

    假設(shè)你在www根目錄下放了一個(gè)文件default.asp,這個(gè)文件的絕對(duì)路徑就是: font color="#0058db">http://www.ajaxstu.com/default.asp。

    假設(shè)你在www根目錄下建了一個(gè)目錄叫archives,然后在該目錄下放了一個(gè)文件2886.html,這個(gè)文件的絕對(duì)路徑就是http://www.ajaxstu.com/archives/2886.html。

    posted @ 2011-08-22 01:12 GavinMiao 閱讀(9352) | 評(píng)論 (2)編輯 收藏

    String、StringBuffer、StringBuilder

    區(qū)別與聯(lián)系:
    1.StringBuffer是線程安全的,String和StringBuilder不是;
    2.StringBuffer和StringBuilder都是可變的,修改是針對(duì)自身的,而String是不可變的,修改一次就創(chuàng)建一個(gè)新的String對(duì)象;
    3.String和StringBuffer都是final類型;
    4.一般,效率上StringBuiler>StringBuffer>String
    5.StringBuilder是5.0新增的;
    用法:
    一、String
    1.常用構(gòu)造函數(shù):
    1)String(char[] value):
    eg:     
    char data[] = {'a', 'b', 'c'};
          String str = new String(data);
          2)String(String original):
          3)String(StringBuffer buffer): 
          4)String(StringBuilder builder): 
          5)String(byte[] bytes, String charsetName) :
          eg:
          String s_iso88591 = new String("中".getBytes("UTF-8"),"ISO8859-1");
          String s_utf8 = new String(s_iso88591.getBytes("ISO8859-1"),"UTF-8");
          注意:GBK編碼是一個(gè)中文2個(gè)字節(jié),而UTF-8編碼是一個(gè)中文3個(gè)字節(jié),
          ISO-8859-1編碼是一個(gè)字節(jié)對(duì)應(yīng)一個(gè)字符;
          String gbk = "我來(lái)了";  
        String iso = new String(gbk.getBytes("UTF-8"),"ISO-8859-1"); 
          2.常用方法:
          1)charAt 方法,返回指定index的字符。
    String string ="123456789";
    char a =string.charAt(2);
    System.out.print(a);
      a=3
          2)indexOf(int ch)
    ch:unicode code point,如果字符串中沒有ch,則返回-1
    String ss = "abcde";
    System.out.println(ss.indexOf(2));
    System.out.println(ss.indexOf(98));
    結(jié)果:-1 1
    因?yàn)?對(duì)應(yīng)的unicode在字符串ss中不存在,所以返回值-1,98對(duì)應(yīng)的unicode 是b,所以返回值是index=1
         
          3)concat(String str)將參數(shù)連接到字符串的末尾
    concatenate 如鎖鏈般連續(xù),使連鎖,連結(jié)
    string ="abc";
    System.out.print(string.concat("123"));
    結(jié)果:abc123
    如果str的length是0,那么這個(gè)String就會(huì)被返回。
          4)hashCode 返回字符串的hashCode值
    String string0 ="abc";
    String string1 ="abc";
    System.out.println(string1.hashCode());
    System.out.println(string1.hashCode());
    結(jié)果:
    96354
    96354
          5)contains(CharSequence s)是否包含參數(shù)
    String string0 ="abcdef";
    System.out.println( string0.contains("de"));
    結(jié)果:true
          6)startsWith(String perfix) 是否以perfix開頭,yes 返回true ,no返回false
    String string ="abcbd";
    System.out.println(    string.startsWith("abc"));
    System.out.println(    string.startsWith("Ab"));
    結(jié)果:true
    false
          7)endsWith(String suffix)是否以suffix結(jié)尾,yes 返回true ,no返回false
    String string ="abcde";
    System.out.println(    string.endsWith("e"));
    結(jié)果:true
          8)trim()去掉字符串的前后空格
    String string =" abc ";
    System.out.println(string.length()+","+    string.trim().length());
    結(jié)果:5,3
    9)length() 字符串的長(zhǎng)度
       char chars[]={'a','b'.'c'};
        String s=new String(chars);
        int len=s.length();
    10)char[] toCharArray() 將一個(gè)字符串轉(zhuǎn)換成一個(gè)字符數(shù)組
    11)equals()和equalsIgnoreCase() 比較兩個(gè)字符串
    12)substring()  
    第一種是:String substring(int startIndex)
            第二種是:String substring(int startIndex,int endIndex)
    13)toLowerCase() 和toUpperCase() 
    二、StringBuffer
    1、構(gòu)造器:
    StringBuffer()
       StringBuffer(int size)
       StringBuffer(String str)
       StringBuffer(CharSequence chars)
    2、方法:
    1)append() 可把任何類型數(shù)據(jù)的字符串表示連接到調(diào)用的StringBuffer對(duì)象的末尾
    2)insert(int offset,Object) 在offset處插入Object對(duì)應(yīng)的字符串到StringBuffer對(duì)象
    3)delete(int start,int end) 刪除字符
    4)indexOf()
    5)reverse() 顛倒StringBuffer對(duì)象中的字符
    6)length()
    7)toString()
    8)subString(int start)  或subString(int start,int end)截取子串
    三、StringBuilder
    1.構(gòu)造器
    與StringBuffer相同
    2.常用的方法:
    與StringBuffer相同
    1)追加:Append
    2)插入:Insert
    3)刪除:Remove
    4)替換:Replace
    參考來(lái)源:
    http://m.tkk7.com/chenpengyi/archive/2006/05/04/44492.html
    http://zhuhuide2004.iteye.com/blog/562739
    http://www.iteye.com/topic/1097560
    http://www.cnblogs.com/crazyac/articles/2012791.html

    posted @ 2011-08-21 01:00 GavinMiao 閱讀(899) | 評(píng)論 (0)編輯 收藏

    各種在線api地址

    J2SE1.7英文api地址: http://download.oracle.com/javase/7/docs/api/
    J2SE1.6英文api地址:  http://download.oracle.com/javase/6/docs/api/
    J2SE1.5 英文api地址:http://download.oracle.com/javase/1.5.0/docs/api/
    J2SE1.4 英文api地址:http://download.oracle.com/javase/1.4.2/docs/api/ 
    J2EE1.5英文api地址:   http://download.oracle.com/javaee/5/api/
    J2EE1.6英文api地址:   http://download.oracle.com/javaee/6/api/
    J2EE1.4英文api地址:   http://download.oracle.com/javaee/1.4/api/  
    J2SE1.6中文api地址:http://www.xasxt.com/java/api/ 
    struts2.1.8.1英文api地址:  http://struts.apache.org/2.2.1/struts2-core/apidocs/
    struts1.3.8英文api地址:    http://struts.apache.org/1.3.8/apidocs/index.html
    struts1.3.10英文api地址:   1.3.10 http://struts.apache.org/1.x/apidocs/
    spring2.5英文api地址:   http://static.springsource.org/spring/docs/2.5.x/api/index.html  
    spring2.0英文api地址:   http://static.springsource.org/spring/docs/2.0.x/api/index.html   
    spring2.5.2中文 reference地址:  http://ajava.org/online/spring2.5/html/
    spring2.0中文 reference地址: http://ajava.org/online/spring2/html/
    hibernate3.5.6 Final英文api地址: http://docs.jboss.org/hibernate/core/3.5/javadocs/  
    hibernate3.5.6 Final中文reference地址: http://docs.jboss.org/hibernate/core/3.5/reference/zh-CN/html/ mysql5.1中文reference地址:http://ajava.org/online/mysql5.1/
    css2中文手冊(cè):http://ajava.org/online/css2/
    jquery1.3api:http://ajava.org/online/jQueryAPIhtml/
    actionscript3語(yǔ)言和組件參考:http://ajava.org/online/ActionScript3/
    ehcache1.7英文api:   http://ajava.org/online/ehcache-1.7.0-javadoc/
    java語(yǔ)言編碼規(guī)范中文版: http://doc.javanb.com/code-conventions-for-the-java-programming-language-zh/index.html  
    log4j1.2.15 api :http://ajava.org/online/log4j-1.2.15-api/

    tomcat5.5-doc:http://tomcat.apache.org/tomcat-5.5-doc/introduction.html
    tomcat6.0-doc:http://tomcat.apache.org/tomcat-6.0-doc/introduction.html 
    tomcat7.0-doc:http://tomcat.apache.org/tomcat-7.0-doc/index.html 
    轉(zhuǎn)載請(qǐng)注明出處!

    posted @ 2011-08-20 17:06 GavinMiao 閱讀(5168) | 評(píng)論 (1)編輯 收藏

    寫一個(gè)toJSON方法將Map對(duì)象轉(zhuǎn)換成JSON字符串

    /**
     * 
     * @author gavin
     *
     */
    public class Gson{
    public static String toJson(Map<String,String> map){
       Set<String> keys = map.keySet();
       String key = "";
       String value = "";
       StringBuffer jsonBuffer = new StringBuffer();
       jsonBuffer.append("{");    
       for(Iterator<String> it = keys.iterator();it.hasNext();){
           key =  (String)it.next();
           value = map.get(key);
           jsonBuffer.append(key+":"+value);
           if(it.hasNext()){
                jsonBuffer.append(",");
           }
       }
       jsonBuffer.append("}");
       return jsonBuffer.toString();
    }
    public static String toJson2(Map<String,String> map){
    Set<Map.Entry<String, String>> entrys = map.entrySet();
    Map.Entry<String, String> entry = null;
       String key = "";
       String value = "";
       StringBuffer jsonBuffer = new StringBuffer();
       jsonBuffer.append("{");    
       for(Iterator<Map.Entry<String, String>> it = entrys.iterator();it.hasNext();){
        entry =  (Map.Entry<String, String>)it.next();
        key = entry.getKey();
           value = entry.getValue();
           jsonBuffer.append(key+":"+value);
           if(it.hasNext()){
                jsonBuffer.append(",");
           }
       }
       jsonBuffer.append("}");
       return jsonBuffer.toString();
    }
    public static void main(String args[]){
    Map<String,String> map = new TreeMap<String,String>();
    map.put("1", "zhangyi");
    map.put("2", "zhanger");
    map.put("3", "zhangsan");
    map.put("4", "zhangsi");
    map.put("5", "zhangwu");
    System.out.println(toJson(map));
    System.out.println(toJson2(map));
    }
    }

    運(yùn)行結(jié)果:

    {1:zhangyi,2:zhanger,3:zhangsan,4:zhangsi,5:zhangwu}
    {1:zhangyi,2:zhanger,3:zhangsan,4:zhangsi,5:zhangwu}

    posted @ 2011-08-19 00:23 GavinMiao 閱讀(11746) | 評(píng)論 (3)編輯 收藏

    oracle to_date、to_char、trunc

    來(lái)源:http://blog.sina.com.cn/s/blog_4fd11d0a0100kaz4.html

    日期到字符操作 
      select sysdate,to_char(sysdate,’yyyy-mm-dd hh24:mi:ss’) from dual   
      select sysdate,to_char(sysdate,’yyyy-mm-dd hh:mi:ss’) from dual   
      select sysdate,to_char(sysdate,’yyyy-ddd hh:mi:ss’) from dual 
      select sysdate,to_char(sysdate,’yyyy-mm iw-d hh:mi:ss’) from dual 
    字符到日期操作   
      select to_date(’2003-10-17 21:15:37’,’yyyy-mm-dd hh24:mi:ss’) from dual
    trunk函數(shù)的使用 
      select trunc(sysdate ,’YEAR’) from dual 
      select trunc(sysdate ) from dual 
      select to_char(trunc(sysdate ,’YYYY’),’YYYY’) from dual 

    posted @ 2011-08-18 17:57 GavinMiao 閱讀(616) | 評(píng)論 (0)編輯 收藏

    oracle并交差

    轉(zhuǎn)載:http://chenhua-1984.iteye.com/blog/350354

    集合操作有 并,交,差 3種運(yùn)算。 

     union :得到兩個(gè)查詢結(jié)果的并集,并且自動(dòng)去掉重復(fù)行。不會(huì)排序 

     union all:得到兩個(gè)查詢結(jié)果的并集,不會(huì)去掉重復(fù)行。也不會(huì)排序 

     intersect:得到兩個(gè)查詢結(jié)果的交集,并且按照結(jié)果集的第一個(gè)列進(jìn)行排序 

     minus:得到兩個(gè)查詢結(jié)果的減集,以第一列進(jìn)行排序 

    例子: 

      下面是兩個(gè)表:一個(gè)主修課程表,一個(gè)選修課程表。 

    這個(gè)是主修課程表:minors 

         create table minors( 
             minor_id number primary key, 
             minor_name varchar2(30) not null, 
             credit_hour number(2) 
          ) 

    插入3條記錄:                

          insert into minors values(10101,'計(jì)算機(jī)原理',4) 
          insert into minors values(10201,'自動(dòng)控制原理',3) 
          insert into minors values(10301,'工程制圖原理',4) 

    下面創(chuàng)建選修課程表minors2 

           create table minors2( 
             minor_id number primary key, 
             minor_name varchar2(30) not null, 
             credit_hour number(2) 
           ) 

    插入兩條記錄: 
            insert into minors2 values(10201,'自動(dòng)控制原理',3) 
           insert into minors2 values(10301,'工程制圖原理',4)   

    兩個(gè)表使用union all:得到如下結(jié)果 

            select minor_id,minor_name,credit_hour from minors union all 
           select minor_id,minor_name,credit_hour from minors2 order by     credit_hour 

    結(jié)果: 
        
    MINOR_ID MINOR_NAME                     CREDIT_HOUR 
    ---------- ------------------------------ ----------- 
         10201 自動(dòng)控制原理                             3 
         10201 自動(dòng)控制原理                             3 
         10101 計(jì)算機(jī)原理                               4 
         10301 工程制圖原理                             4 
         10301 工程制圖原理                             4 

    兩個(gè)表使用union :得到如下結(jié)果 

    select minor_id,minor_name,credit_hour from minors union 
        select minor_id,minor_name,credit_hour from minors2 order by credit_hour 

    結(jié)果: 

    MINOR_ID MINOR_NAME                     CREDIT_HOUR 
    ---------- ------------------------------ ----------- 
         10201 自動(dòng)控制原理                             3 
         10101 計(jì)算機(jī)原理                               4 
         10301 工程制圖原理                             4 

    兩個(gè)表使用intersect :得到如下結(jié)果 

         select minor_id,minor_name,credit_hour from minors intersect 
        select minor_id,minor_name,credit_hour from minors2 

    結(jié)果: 

    MINOR_ID MINOR_NAME                     CREDIT_HOUR 
    ---------- ------------------------------ ----------- 
         10201 自動(dòng)控制原理                             3 
         10301 工程制圖原理                             4 

    兩個(gè)表使用minus :得到如下結(jié)果 

        select minor_id,minor_name,credit_hour from minors minus 
        select minor_id,minor_name,credit_hour from minors2 

    結(jié)果: 

    MINOR_ID MINOR_NAME                     CREDIT_HOUR 
    ---------- ------------------------------ ----------- 
         10101 計(jì)算機(jī)原理                               4

    posted @ 2011-08-18 17:34 GavinMiao 閱讀(479) | 評(píng)論 (0)編輯 收藏

    線程創(chuàng)建及調(diào)用方式

    方法一:
    public class MyThread  extends Tread{
        //覆蓋Tread的run方法
        public void run(){
            。。。
        }
        //調(diào)用
        public static void main(String[] args){
            new MyTread().start();
        }
    }
    方法二:
    public class MyTread implements Runnable{
        //實(shí)現(xiàn)Runnable的run方法
        public void run(){
            。。。
        }
        //調(diào)用
        public static void main(String[] args){
            new Tread(new MyTread()).start();
        }
    }

    posted @ 2011-08-14 23:21 GavinMiao 閱讀(199) | 評(píng)論 (0)編輯 收藏

    jsp scriptlet

    jsp有中調(diào)用java方式:
     <%%>:scriptlet
    <%!%>:聲明
    <%=%>:表達(dá)式
    yourJspName_jsp.java對(duì)應(yīng) yourname.jsp
    經(jīng)驗(yàn)證,<%! code %>無(wú)論寫在yourname.jsp的任何位置,code都處在yourJspName_jsp.java的成員聲明中;
    經(jīng)驗(yàn)證, <% code %>無(wú)論寫在yourname.jsp的任何位置,code都處在yourJspName_jsp.java的_jspService成員方法中;
    經(jīng)驗(yàn)證,<%=statement%>無(wú)論寫在yourname.jsp的任何位置,statement都處在yourJspName_jsp.java的_jspService成員方法中的out.write(statement)中;
    注意:
    1.
    用 <%!   %> 定義的變量,成為這個(gè)類的變量,用 <%!   %> 定義的方法也是如此,成為這個(gè)類的方法。
    2.
    <%...%> 中定義的變量其實(shí)是方法   _jspService()   的內(nèi)部變量. 即類的局部變量。

    posted @ 2011-08-10 19:05 GavinMiao 閱讀(295) | 評(píng)論 (0)編輯 收藏

    僅列出標(biāo)題
    共14頁(yè): First 上一頁(yè) 6 7 8 9 10 11 12 13 14 下一頁(yè) 
    主站蜘蛛池模板: 久久亚洲av无码精品浪潮| 亚洲精品欧洲精品| 在线看无码的免费网站| 日韩免费福利视频| 久久精品国产亚洲av四虎| 亚洲成av人片在线天堂无| 久久午夜夜伦鲁鲁片免费无码| 久久久久久国产精品免费免费| 国产亚洲高清不卡在线观看| 亚洲精品天堂在线观看| 精品国产免费一区二区三区香蕉| 日本xxwwxxww在线视频免费| 亚洲av色香蕉一区二区三区| 亚洲高清中文字幕免费| 亚洲av鲁丝一区二区三区| 色偷偷亚洲第一综合网| 亚洲免费综合色在线视频| 久久精品夜色国产亚洲av| 最近2019免费中文字幕视频三| 亚洲国产日韩在线成人蜜芽| 在线免费观看你懂的| 色在线亚洲视频www| 中文字幕乱码免费视频| 亚洲成在人线av| 成在人线av无码免费高潮水| 全黄性性激高免费视频| 亚洲av乱码中文一区二区三区| 国产女高清在线看免费观看 | 国产香蕉免费精品视频| 亚洲一区二区三区在线观看网站| 一级毛片成人免费看免费不卡| 久久亚洲精品无码播放| 热re99久久6国产精品免费| 亚洲熟女一区二区三区| 国产精品高清免费网站| 亚洲一区二区视频在线观看| 免费精品国自产拍在线播放| 免费无码黄动漫在线观看| 亚洲国产成人无码AV在线 | 亚洲丝袜美腿视频| 久久久久久久久久国产精品免费|