直接遍历报错:[Ljava.lang.String;@44739f3f
Map<String, String> tempMap = new HashMap<String, String>();
Map<String, String[]> reqMap = req.getParameterMap();
Set<Entry<String, String[]>> set = reqMap.entrySet();
Iterator<Entry<String, String[]>> it = set.iterator();
while (it.hasNext()) {
Entry<String, String[]> entry = it.next();
System.out.println("KEY:"+entry.getKey());
for (String str : entry.getValue()) {
System.out.println(str);
tempMap.put(entry.getKey(), str);
}
}
顺便写一下Map的遍历:
Set<Map.Entry<String, String>> itermap = resMap.entrySet();
for (Map.Entry<String, String> entry : itermap) {
String key = entry.getKey();
String value = entry.getValue();
System.out.println(key + ": " + value);
}