@RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}) public ModelAndView main( Product product, PageParameter page, ModelMap model, HttpSession httpSession) { User user = httpSession.getAttribute("user") != null ? (User) httpSession.getAttribute("user") : null; // if(httpSession.getAttribute("resTopList")==null){ JSONArray toplist = JSONArray.fromObject(mainService.getResource(user, "top")); JSONArray leftlist = JSONArray.fromObject(mainService.getResource(user, "left")); httpSession.setAttribute("resTopList", toplist); httpSession.setAttribute("resList", leftlist); // } Notice notice = new Notice(); try { model.addAttribute("notices", noticeService.getNotices(notice, page)); } catch (DaoException e) { logger.error("", e); } User us = new User(); us.setUserId(user.getUserId()); User u = (User) userDao.getUser(us); model.addAttribute("userbean", u); return new ModelAndView("main.jsp"); }
@RequestMapping("/getIndexEvents") public @ResponseBody Map<String, Object> getIndexEvents( Event event, Concern concern, PageParameter page, ModelMap model, HttpSession httpSession) { Map<String, Object> map = new HashMap<String, Object>(); try { if (concern != null && StringUtils.isNotBlank(concern.getConcernType())) { User user = this.getSessionUser(httpSession); // User user = // httpSession.getAttribute("user")!=null?(User)httpSession.getAttribute("user"):null; concern.setUserId(user.getUserId()); map.put("objs", eventService.getConcernPage(concern, page)); } else { map.put("objs", eventService.getPage(event, page)); } map.put("page", page); } catch (DaoException e) { logger.error("查询活动分页错误", e); } return map; }