springmvc 多文件上传 MultipartFile 怎么获取前台传过来的参数
1个回答
2016-07-03 · 做真实的自己 用良心做教育
千锋教育
千锋教育专注HTML5大前端、JavaEE、Python、人工智能、UI&UE、云计算、全栈软件测试、大数据、物联网+嵌入式、Unity游戏开发、网络安全、互联网营销、Go语言等培训教育。
向TA提问
关注
展开全部
用@ResponseBody
@RequestMapping(value = "/address", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> addressPOST() {
Map<String, Object> map = new HashMap<>();
ReceivedGoodsAddress receivedgoodsaddress=new ReceivedGoodsAddress();
List<ReceivedGoodsAddress> list = addressService.findReceivedGoodsAddress(receivedgoodsaddress);
map.clear();
map.put("list", list);
return map;
}
//前台用jquery+ajax
$.ajax({
type:'POST',
url:'${contextPath}/address',
dataType:'json',
success:function(data){
$.each(data.list,function(i,item){
alert(i);
alert(item.id);
alert(item.name);
});
}
});
@RequestMapping(value = "/address", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> addressPOST() {
Map<String, Object> map = new HashMap<>();
ReceivedGoodsAddress receivedgoodsaddress=new ReceivedGoodsAddress();
List<ReceivedGoodsAddress> list = addressService.findReceivedGoodsAddress(receivedgoodsaddress);
map.clear();
map.put("list", list);
return map;
}
//前台用jquery+ajax
$.ajax({
type:'POST',
url:'${contextPath}/address',
dataType:'json',
success:function(data){
$.each(data.list,function(i,item){
alert(i);
alert(item.id);
alert(item.name);
});
}
});
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询