Пример #1
0
 public String mod(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   Category category = CommonUtils.toBean(request.getParameterMap(), Category.class);
   categoryService.mod(category);
   request.setAttribute("msg", "修改分类成功!");
   return "/adminjsps/admin/msg.jsp";
 }
Пример #2
0
  public String del(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String cid = request.getParameter("cid");

    try {
      categoryService.del(cid);
    } catch (CategoryException e) {
      String msg = e.getMessage();
      request.setAttribute("msg", msg);
      Category category = categoryService.findByCid(cid);
      request.setAttribute("category", category);
      return "/adminjsps/admin/category/desc.jsp";
    }
    request.setAttribute("msg", "删除分类成功!");
    return "/adminjsps/admin/msg.jsp";
  }
Пример #3
0
 public String desc(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   String cid = request.getParameter("cid");
   Category category = categoryService.findByCid(cid);
   request.setAttribute("category", category);
   return "/adminjsps/admin/category/desc.jsp";
 }
Пример #4
0
 public String all(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   /*
    * 1使用service获取所有分类
    * 2把所有分类保存到request
    * 3转到all页面
    */
   List<Category> categoryList = categoryService.all();
   request.setAttribute("list", categoryList);
   return "/adminjsps/admin/category/all.jsp";
 }
Пример #5
0
  public String add(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    Category category = CommonUtils.toBean(request.getParameterMap(), Category.class);
    category.setCid(CommonUtils.uuid());

    try {
      categoryService.add(category);
    } catch (CategoryException e) {
      String msg = e.getMessage();
      request.setAttribute("msg", msg);
      return "/adminjsps/admin/category/add.jsp";
    }
    request.setAttribute("msg", "添加分类成功!");
    return "/adminjsps/admin/msg.jsp";
  }