public static Map<String,Object> getRequestParamMap(HttpServletRequest request){ Map<String,Object> map = new HashMap<>(); //得到枚举类型的参数名称,参数名称若有重复的只能得到第一个 Enumeration<String> enums = request.getParameterNames(); while (enums.hasMoreElements()) { String paramName = (String) enums.nextElement(); String paramValue = request.getParameter(paramName); //形成键值对应的map map.put(paramName, paramValue); } return map; }
request转map
最新推荐文章于 2023-05-12 21:34:26 发布