HttpServletRequest request 转 Json
private void saveOperationRecord(HttpServletRequest req, ......){ //从 request 请求中 提取所有的form-data 参数,将参数转换成json 类型参数 Enumeration<String> parameterNames = req.getParameterNames(); String parm=null; while(parameterNames.hasMoreElements()){ parm=parameterNames.nextElement(); parmMap.put(parm, req.getParameter(parm)); } String jsonString = JSON.toJSONString(parmMap); System.out.println("jsonString=========="+jsonString); }