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"; }
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"; }