Пример #1
0
 @RequestMapping("/index")
 public void getIndex(HttpServletRequest request, HttpServletResponse response) throws Exception {
   request.setAttribute("noticeList", noticeService.getIndexNotice()); // 通知
   request.setAttribute("specialGoods", goodsService.getSpecialGoods()); // 广告
   request.setAttribute("newGoods", goodsService.getNewGoods()); // 新品上架
   request.setAttribute("loveGoods", goodsService.getLoveGoods());
   request.getRequestDispatcher("/index.jsp").forward(request, response);
 }
Пример #2
0
 @RequestMapping("/good")
 public void getPage(
     @RequestParam(value = "goodId", required = false) String goodId,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   request.setAttribute("goodId", goodId);
   request.setAttribute("goods", goodsService.getById(Integer.valueOf(goodId)));
   request.setAttribute("otherGoodsList", goodsService.getBySeller(Integer.valueOf(goodId)));
   request.getRequestDispatcher("/goods.jsp").forward(request, response);
 }
Пример #3
0
 @RequestMapping("/search")
 public void getSearchList(
     @RequestParam(value = "search", required = false) String search,
     @RequestParam(value = "page", required = false) String page,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   request.setAttribute("hotList", goodsService.getHotGoods());
   if (page == null || page.equals("") || Integer.valueOf(page) < 1) {
     page = "1";
   }
   request.setAttribute("search", search); // 商品类型
   request.setAttribute("page", page); // 当前页
   request.setAttribute("pageNum", goodsService.getSearchNum(search)); // 总页数
   request.setAttribute(
       "goodsList", goodsService.getSearchList(search, 16 * (Integer.valueOf(page) - 1), 16));
   request.getRequestDispatcher("/searchlist.jsp").forward(request, response);
 }
Пример #4
0
 @RequestMapping("/usermanager")
 public void getUsermanager(
     @RequestParam(value = "userId", required = false) String userId,
     @RequestParam(value = "page", required = false) String page,
     HttpServletRequest request,
     HttpServletResponse response,
     HttpSession session)
     throws Exception {
   if (page == null || Integer.valueOf(page) < 1 || page.equals("")) {
     page = "1";
   }
   request.setAttribute(
       "goodsList",
       goodsService.getByUserId2(Integer.valueOf(userId), 5 * (Integer.valueOf(page) - 1), 5));
   session.setAttribute("userId", userId);
   request.setAttribute("page", page);
   request.setAttribute("allPage", goodsService.getPublishNum(Integer.valueOf(userId)) / 5 + 1);
   request.getRequestDispatcher("/usermanager.jsp").forward(request, response);
 }
Пример #5
0
 @RequestMapping("/umdelete")
 public void deleteGoods(
     @RequestParam(value = "goodsId", required = false) String goodsId,
     HttpServletRequest request,
     HttpServletResponse response,
     HttpSession session)
     throws Exception {
   goodsService.deleteGoods(Integer.valueOf(goodsId));
   response.sendRedirect("/MyStore/usermanager.do?userId=" + session.getAttribute("userId"));
   // request.getRequestDispatcher("/usermanager.do?userId="+session.getAttribute("userId")).forward(request, response);
 }