1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| @Autowired private TypeService typeService;
@RequestMapping("/index") public String index(HttpServletRequest request){ request.setAttribute("flag", 1); request.setAttribute("typeList", typeService.getList()); request.setAttribute("top1List", topService.getList(Tops.TYPE_SCROLL, 1, 1)); request.setAttribute("top2List", topService.getList(Tops.TYPE_LARGE, 1, 6)); request.setAttribute("top3List", topService.getList(Tops.TYPE_SMALL, 1, 8)); return "/index/index.jsp"; }
@RequestMapping("/top") public String tops(int typeid, @RequestParam(required=false, defaultValue="1")int page, HttpServletRequest request) { request.setAttribute("flag", typeid==2 ? 7 : 8); request.setAttribute("typeList", typeService.getList()); request.setAttribute("goodList", goodService.getList(typeid, page, rows)); request.setAttribute("pageTool", PageUtil.getPageTool(request, goodService.getTotal(typeid), page, rows)); return "/index/goods.jsp"; }
@RequestMapping("/goods") public String goods(int typeid, @RequestParam(required=false, defaultValue="1")int page, HttpServletRequest request){ request.setAttribute("flag", 2); if (typeid > 0) { request.setAttribute("type", typeService.get(typeid)); } request.setAttribute("typeList", typeService.getList()); request.setAttribute("goodList", goodService.getListByType(typeid, page, rows)); request.setAttribute("pageTool", PageUtil.getPageTool(request, goodService.getTotalByType(typeid), page, rows)); return "/index/goods.jsp"; }
|