List of usage examples for org.springframework.web.servlet.mvc.support RedirectAttributes addFlashAttribute
RedirectAttributes addFlashAttribute(String attributeName, @Nullable Object attributeValue);
From source file:controllers.SequenceController.java
@RequestMapping(value = "/add") public String addScene(Map<String, Object> model, @ModelAttribute("sequence") Sequence seq, BindingResult result, HttpServletRequest request, RedirectAttributes ras) throws Exception { sequenceService.create(seq);/* w w w .j a v a2s . co m*/ ras.addFlashAttribute("error", sequenceService.getResult().getErrors()); return "redirect:/Sequence/show"; }
From source file:com.redhat.rhtracking.web.controller.PartnerController.java
@RequestMapping(value = "/partner/add", method = RequestMethod.POST) public String save(@Valid @ModelAttribute("partnerInfo") PartnerInfo partnerInfo, BindingResult result, RedirectAttributes redirectAttributes, Model model, Principal principal) { List<String> messages = getMessagesList(model); redirectAttributes.addFlashAttribute("messages", messages); if (result.hasErrors()) { messages.add("warning::Datos incorrectos"); redirectAttributes.addFlashAttribute("org.springframework.validation.BindingResult.register", result); redirectAttributes.addFlashAttribute("partnerInfo", partnerInfo); return "redirect:/partner/add"; }/*from w w w. ja va2s .c o m*/ Map<String, Object> request = new HashMap<>(); request.put("name", partnerInfo.getName()); request.put("contact", partnerInfo.getContact()); request.put("telephone", partnerInfo.getTelephone()); request.put("email", partnerInfo.getEmail()); request.put("rfc", partnerInfo.getRfc()); request.put("costType", partnerInfo.getCostType()); logger.debug("saving " + request); Map<String, Object> response = partnerService.savePartner(request); if (response.get("status") == com.redhat.rhtracking.events.EventStatus.SUCCESS) messages.add("success::Agregado correctamente"); else messages.add("error::Ocurrio un error al registrar la matriz de entrega."); return "redirect:/partner/"; }
From source file:de.whs.poodle.controllers.instructor.InstructorExerciseController.java
@RequestMapping(method = RequestMethod.POST, params = "delete") @PreAuthorize("@instructorSecurity.hasAccessToExercise(authentication.name, #exerciseId)") public String delete(Model model, @PathVariable int exerciseId, RedirectAttributes redirectAttributes) { try {/*from w w w .j a v a2s .c om*/ exerciseRepo.delete(exerciseId); } catch (ForbiddenException e) { redirectAttributes.addFlashAttribute("errorMessageCode", "cantDeleteExercise"); return "redirect:/instructor/exercises/{exerciseId}"; } redirectAttributes.addFlashAttribute("okMessageCode", "exerciseDeleted"); return "redirect:/instructor"; }
From source file:controllers.ColorController.java
@RequestMapping("/updateColor") public String updateColor(Map<String, Object> model, @RequestParam("colorId") Long colorId, @RequestParam("uid") String uid, @RequestParam("paramValue") String paramValue, @RequestParam("percentValue") Long percentValue, @RequestParam("radical") String radical, @RequestParam(value = "audial", required = false) Integer audial, @RequestParam(value = "visual", required = false) Integer visual, @RequestParam(value = "kinestet", required = false) Integer kinestet, RedirectAttributes ras) throws Exception { colorService.updateColor(colorId, uid, paramValue, percentValue, radical, audial, visual, kinestet); ras.addFlashAttribute("error", colorService.getResult().getErrors()); return "redirect:/Color/show"; }
From source file:cn.newtouch.dms.web.member.MemberController.java
@RequestMapping(value = "delete/{id}") public String delete(@PathVariable("id") Integer id, RedirectAttributes redirectAttributes) { Member member = memberService.selectMemberById(id); memberService.deleteMember(id);//from ww w . j ava 2 s. c o m redirectAttributes.addFlashAttribute("message", "" + member.getPdcId() + "?"); return "redirect:/admin/member"; }
From source file:com.bangla.store.controller.EmployeeController.java
@RequestMapping(value = "/add", method = RequestMethod.POST) public String postAdd(@ModelAttribute("employee") @Valid Employee employee, BindingResult br, RedirectAttributes ra) { if (br.hasErrors()) { return "employee/add"; } else {//from w ww .j a va 2s . c o m employeeService.create(employee); ra.addFlashAttribute("message", "Successfully added item."); return "redirect:/employee"; } }
From source file:de.whs.poodle.controllers.AdminController.java
@RequestMapping(method = RequestMethod.POST, params = "changeCourseInstructor") @PreAuthorize("@instructorSecurity.hasAdminAccess(authentication.name)") public String changeCourseInstructors(@RequestParam(required = false) List<Integer> value, @RequestParam int changeCourseInstructor, RedirectAttributes redirectAttributes, Model model) { if (value == null) { redirectAttributes.addFlashAttribute("errorMessageCode", "noInstructor"); } else {/* w w w . ja va2s . co m*/ redirectAttributes.addFlashAttribute("okMessageCode", "settingsSaved"); adminRepo.changeCourseInstructors(value, changeCourseInstructor); } return "redirect:/adminmenu"; }
From source file:controllers.ColorController.java
@RequestMapping("/updateAllInTitle") public String updateAllInTitle(Map<String, Object> model, @RequestParam("title") String title, @RequestParam("uid") String uid, @RequestParam("paramValue") String paramValue, @RequestParam("percentValue") Long percentValue, @RequestParam("radical") String radical, @RequestParam(value = "audial", required = false) Integer audial, @RequestParam(value = "visual", required = false) Integer visual, @RequestParam(value = "kinestet", required = false) Integer kinestet, RedirectAttributes ras) throws Exception { colorService.updateAllInTitle(title, uid, paramValue, percentValue, radical, audial, visual, kinestet); ras.addFlashAttribute("error", colorService.getResult().getErrors()); return "redirect:/Color/show"; }
From source file:controllers.SequenceController.java
@RequestMapping(value = "/delete") public String delete(Map<String, Object> model, @RequestParam("sequenceId") Long sequenceId, RedirectAttributes ras) throws Exception { sequenceService.delete(sequenceId);/* w w w . j av a 2s . c om*/ ras.addFlashAttribute("error", sequenceService.getResult().getErrors()); return "redirect:/Sequence/show"; }
From source file:org.jessezhu.starriver.controller.UserAdminController.java
@RequestMapping(value = "delete/{id}") public String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttributes) throws Exception { User user = accountService.selectByKey(id); taskService.deleteByUserId(id);/* w w w . java 2 s . co m*/ accountService.deleteById(id); redirectAttributes.addFlashAttribute("message", "" + user.getLoginName() + "?"); return "redirect:/admin/user"; }