将前台ajax请求的参数转换成map
当一个参数对应多个值时,获取到的参数将以“,”隔开,例:ajzt:100,300,500
代码段
/**
* 将前台ajax请求的参数转换成map
*
* @param request the request
* @param decode 是否需要解码
* @return Map<String, String> 当一个参数对应多个值时,获取到的参数将以“,”隔开,例:ajzt:100,300,500
*/
public static Map<String, String> splitReqToMap(HttpServletRequest request, boolean decode) {
Map<String, String> map = new HashMap<String, String>();
Enumeration enu = request.getParameterNames();
while (enu.hasMoreElements()) {
String name = (String) enu.nextElement();
if (decode) {
map.put(name, getPar8(name, request));
} else {
map.put(name, getPar(name, request));
}
}
return map;
}