First, HashMap
1. Format:hashmap< type, type > map = new hashmap< type, type > ();
Example: hashmap<string, string> map = new hashmap<string, string> ();
2. Methods
(1) Put (key, value); When key repeats, only the last value assigned to key is obtained
Example: Map.put ("Key1", "Hello");
(2) get ();
Example: Map.get ("Key1");
(3) Putall ();
(4) remove ();
3. Traverse
(1) Iterative traversal
Example: 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 () traversal
Example: for (String Kv:keyset) {
SYSTEM.OUT.PRINTLN (KV);
}
Second, Servlet
1.Servlet is a bridge between the background and the front end.
2.doGet ()--Browser request
DoPost ()--form request
3. Form form
<form Actiong = "" method = "POST" >
<input type = "Text" >
<input type = "submit" value = "Commit" >
</form>
Java Basics Chapter 13th (HASHMAP, servlet introduction)