有一点很不明白
来源:7-2 公布答案:商品类别列表展示从后到前
慕用1382692
2019-09-28
写回答
1回答
-
翔仔
2019-09-29
这个需要同学结合后端方法来看,后端对应的controller方法如下
@RequestMapping(value = "/getshopmanagementinfo", method = RequestMethod.GET) @ResponseBody private Map<String, Object> getShopManagementInfo(HttpServletRequest request) { Map<String, Object> modelMap = new HashMap<String, Object>(); long shopId = HttpServletRequestUtil.getLong(request, "shopId"); if (shopId <= 0) { Object currentShopObj = request.getSession().getAttribute("currentShop"); if (currentShopObj == null) { modelMap.put("redirect", true); modelMap.put("url", "/o2o/shopadmin/shoplist"); } else { Shop currentShop = (Shop) currentShopObj; modelMap.put("redirect", false); modelMap.put("shopId", currentShop.getShopId()); } } else { Shop currentShop = new Shop(); currentShop.setShopId(shopId); request.getSession().setAttribute("currentShop", currentShop); modelMap.put("redirect", false); } return modelMap; }
你的js里面第一个画框框的地方有可能获取不到shopId,即有可能再次访问这个页面的时候,可能没有传入shopId,那么传入后台的时候shopId取不到,则会执行 if shopId<=0的逻辑,从session去获取shopId,或者从让其跳转,如果从后台获取到,则设置shopId的值
022019-09-29
相似问题