@RequestMapping(value = "/expense-category/{operation}/{empId}", method = RequestMethod.GET) public String editRemove( @PathVariable("operation") String operation, @PathVariable("empId") Long id, final RedirectAttributes redirectAttributes, Model model) { if (operation.equals("delete")) { if (expenseCategoryService.delete(id)) { redirectAttributes.addFlashAttribute("deletion", "success"); } else { redirectAttributes.addFlashAttribute("deletion", "unsuccess"); } } else if (operation.equals("edit")) { ExpenseCategory edit = expenseCategoryService.find(id); if (edit != null) { model.addAttribute("edit", edit); return "pages/expense-category/expense-category-form-edit"; } else { redirectAttributes.addFlashAttribute("status", "notfound"); } } return "redirect:/expense-category-list"; }