将前台传回的HttpServletRequest转换成HashMap
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
public static Map<String, Object> handleParamToMap(
HttpServletRequest request) {
Map<String, Object> map = new HashMap<>();
for (Entry<String, String[]> entry : request.getParameterMap()
.entrySet()) {
String[] arr = entry.getValue();
String result = "";
if (null != arr && arr.length > 0) {
for (int i = 0; i < arr.length; i++) {
result += arr[i];
if (i < arr.length - 1) {
result += ",";
}
}
map.put(entry.getKey(), result);
}
}
return map;
}