java基礎 第十三章(HashMap、Servlet介紹)

來源:互聯網
上載者:User

標籤:get   後台   ext   int   hello   mit   next   text   ring   

一、HashMap

    1.格式:HashMap<類型,類型>  map = new HashMap<類型,類型>();

       例:HashMap<String, String> map = new HashMap<String, String>();

    2.方法

      (1)put(key , value); //當key重複時,只能得到最後一次賦給key的value

               例:map.put("key1", "hello");

      (2)get();

                例:map.get("key1");

      (3)putAll();

      (4)remove();

      3.遍曆

      (1)迭代遍曆

             例:set<String>keyset = map.keySet();

                    Interator<String> iter = keyset.iterator();

                    while(iter.hasNext()){

                          String kv = iter.next();

                          String v = map.get();

                          System.out.println(v);

                    }

       (2)for each () 遍曆

                例:for(String kv : keyset){

                           System.out.println(kv);

                        }

二、Servlet

    1.Servlet 是一個後台與前端的一個橋樑。

    2.doGet() ——>瀏覽器請求

       doPost() ——>表單請求

    3.表單 form

        <form actiong = " " method = "POST">

             <input type = "text">

            <input type = "submit" value = "提交”>

        </form>

 

java基礎 第十三章(HashMap、Servlet介紹)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.