map不能存储list

来源:4-10 店铺注册之js实现

慕数据7179807

2019-08-20

我和老师你的一样为什么我的list存储在map里面返回给后台就不会显示呢
http://img1.sycdn.imooc.com/szimg/5d5b581108eff2e410080756.jpg

http://img.mukewang.com/szimg/5d5b581d0845d90d10080756.jpg

写回答

1回答

突出部作战

2019-08-20

貌似你没有<>里标识好类型,可以看看我的,我的没问题

	@RequestMapping(value = "/getshopinitinfo", method = RequestMethod.GET)
	@ResponseBody
	private Map<String, Object> getShopInitInfo() {
		Map<String, Object> modelMap = new HashMap<String, Object>();
		List<ShopCategory> shopCategoryList = new ArrayList<ShopCategory>();
		List<Area> areaList = new ArrayList<Area>();
		try {
			shopCategoryList = shopCategoryService.getShopCategoryList(new ShopCategory());
			areaList = areaService.getAreaList();
			modelMap.put("shopCategoryList", shopCategoryList);
			modelMap.put("areaList", areaList);
			modelMap.put("success", true);
		} catch (Exception e) {
			modelMap.put("success", false);
			modelMap.put("errMsg", e.getMessage());
		}
		return modelMap;
	}


1
1
翔仔
感谢热心大牛的回复,同学可以按照他的试试,如果不行,请检查下你的jackson的版本是否与视频一致,先按大牛的来
2019-08-20
共1条回复

Java双版本(SSM到SpringBoot)校园商铺全栈开发

SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需

5134 学习 · 8152 问题

查看课程