java - controller打印所有请求参数
打印所有请求参数,进行接口调试的时候,设计前端界面的时候,会用到这些代码。
@RequestMapping(value = "/test")
@ResponseBody
public MResult test (HttpServletRequest request, @RequestParam Map<String,Object> params){
try{
System.out.println(params);
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
System.out.println(multipartRequest.getFileMap());
Iterator<String> files = multipartRequest.getFileNames();
while(files.hasNext()){
System.out.println(multipartRequest.getFile(files.next()).getName());
}
}catch (Exception e){
e.printStackTrace();
}
return new MResult(MResult.SUCCESS);
}
疯狂的妞妞 :每一天,做什么都好,不要什么都不做!