public ModelAndView deleteNote(HttpServletRequest request, HttpServletResponse response) throws Exception { int id = com.rcc.web.controller.ControllerUtils.getIntParam(request, "id", 0); this.model.deleteNoteById(id); FlashUtils.messageCode("note.delete.success", request); int h = com.rcc.web.controller.ControllerUtils.getIntParam(request, "d", 0); return new ModelAndView("redirect:" + HistoryUtils.redirectPath(request, h)); }
public ModelAndView recipe(HttpServletRequest request, HttpServletResponse response) throws Exception { User user = ContextUtils.getRequestContext(false).getUser(); ModelAndView mav = new ModelAndView(); int id = com.rcc.web.controller.ControllerUtils.getIntParam(request, "id", 0); if (id == 0) { List<Recipe> recipes = this.model.findRecipesByUser(user.getId()); mav.addObject("content", "RecipeList"); mav.addObject("recipes", recipes); } else { Recipe recipe = this.model.findRecipeById(id); mav.addObject("content", "Recipe"); mav.addObject("recipe", recipe); } return mav; }