我试图在spring的post方法中从表单数据中获取字符串值。
我收到一个错误的请求。
@SuppressWarnings("unchecked")
@RequestMapping(value = "/formdataValueGet", method = RequestMethod.POST, consumes = {"multipart/form-data"})
public ResponseEntity<Map<String, Object>> formdataValueGet(HttpServletRequest request, @RequestParam("file") String file) throws Exception{
System.out.println("Api hit file upload");
Map<String, Object> params = new HashMap<String, Object>();
System.out.println("Map issue");
try{
params.put("error", "Failed to make payment");
return new ResponseEntity<Map<String, Object>>(params, HttpStatus.OK);
}catch(Exception ae){
params.put("error", "Failed to make payment");
return new ResponseEntity<Map<String, Object>>(params, HttpStatus.OK);
}
}
暂无答案!
目前还没有任何答案,快来回答吧!