springmvc 多文件上传 MultipartFile 怎么获取前台传过来的参数
1个回答
展开全部
用@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);
});
}
});
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询