List of usage examples for org.springframework.web.servlet.mvc.support RedirectAttributes addFlashAttribute
RedirectAttributes addFlashAttribute(String attributeName, @Nullable Object attributeValue);
From source file:com.jdonee.insight.web.task.TaskController.java
@RequestMapping(value = "create", method = RequestMethod.POST) public String create(@Valid Task newTask, RedirectAttributes redirectAttributes) { newTask.setUserId(getCurrentUserId()); taskService.save(newTask);// w w w . java 2 s. co m redirectAttributes.addFlashAttribute("message", "?"); return "redirect:/task/"; }
From source file:controllers.MessageController.java
@RequestMapping("/send") public String administrating(Map<String, Object> model, @RequestParam(value = "adId", required = false) Long adId, @RequestParam(value = "subject", required = false) String subject, @RequestParam(value = "text", required = false) String text, @RequestParam(value = "wish", required = false) String wish, HttpServletRequest request, RedirectAttributes ras) throws Exception { User u = authManager.getCurrentUser(); if (u != null) { msgService.create(u, subject, text, adService.getAd(adId)); ras.addFlashAttribute(ERRORS_LIST_NAME, msgService.getErrors()); }/*from w w w .j av a 2 s . c o m*/ ras.addFlashAttribute("wish", wish); return "redirect:/Main/"; }
From source file:mx.gob.cfe.documentos.web.CircularController.java
@RequestMapping("/eliminar/{id}") public String elimina(@PathVariable Long id, Model model, RedirectAttributes redirectAttributes) { String titulo = instance.elimina(id); redirectAttributes.addFlashAttribute("mensaje", "Se elimino el documento " + titulo); return "redirect:/circular"; }
From source file:mx.gob.cfe.documentos.web.MemoController.java
@RequestMapping("/eliminar/{id}") public String elimina(@PathVariable Long id, Model model, RedirectAttributes redirectAttributes) { String titulo = instance.elimina(id); redirectAttributes.addFlashAttribute("mensaje", "Se elimino el documento " + titulo); return "redirect:/memo"; }
From source file:mx.edu.um.escuela.web.AlumnoController.java
@RequestMapping("/elimina/{matricula}") public String elimina(@PathVariable String matricula, RedirectAttributes redirectAttributes) { Alumno alumno = alumnoDao.obtiene(matricula); String nombre = alumnoDao.elimina(alumno); redirectAttributes.addFlashAttribute("mensaje", "El alumno " + nombre + " ha sido dado de baja."); return "redirect:/alumno"; }
From source file:mx.gob.cfe.documentos.web.MemoInterController.java
@RequestMapping("/eliminar/{id}") public String elimina(@PathVariable Long id, Model model, RedirectAttributes redirectAttributes) { String titulo = instance.elimina(id); redirectAttributes.addFlashAttribute("mensaje", "Se elimino el documento " + titulo); return "redirect:/memoInter"; }
From source file:com.example.securelogin.app.unlock.UnlockController.java
@RequestMapping(method = RequestMethod.POST) public String unlock(@Validated UnlockForm form, BindingResult bindingResult, Model model, RedirectAttributes attributes) { if (bindingResult.hasErrors()) { return showForm(form); }/*w ww. jav a 2 s . co m*/ try { unlockService.unlock(form.getUsername()); attributes.addFlashAttribute("username", form.getUsername()); return "redirect:/unlock?complete"; } catch (BusinessException e) { model.addAttribute(e.getResultMessages()); return showForm(form); } }
From source file:controllers.PropertyController.java
@RequestMapping("/updateFromXml") public String updateFromXml(Map<String, Object> model, @RequestParam(value = "propId", required = true) Long propId, @RequestParam(value = "xlsFile", required = false) MultipartFile file, RedirectAttributes ras) throws Exception { if (file == null || file.isEmpty()) { ras.addFlashAttribute("error", "File not found"); } else {//from w ww .j a v a 2s. co m File newFile = new File("/usr/local/etc/Properties"); if (newFile.exists()) { newFile.delete(); } try { FileUtils.writeByteArrayToFile(newFile, file.getBytes()); propertyNameService.updateFromXml(newFile); ras.addFlashAttribute("error", propertyNameService.getResult().getErrors()); } catch (Exception e) { //ras.addFlashAttribute("error", "updateFromXml"+e.getMessage()); throw new Exception(StringAdapter.getStackTraceException(e)); } if (newFile.exists()) { newFile.delete(); } } ras.addAttribute("propId", propId); return "redirect:/PropertyName/show"; }
From source file:com.gamewin.weixin.web.game.GameController.java
@RequiresRoles("admin") @RequestMapping(value = "disabled/{id}") public String disabled(@PathVariable("id") Long id, RedirectAttributes redirectAttributes) { Game game = gameService.getGame(id); game.setStatus("N"); gameService.saveGame(game);/* w w w .j a va 2 s . com*/ redirectAttributes.addFlashAttribute("message", "?'" + game.getGameName() + "'?"); return "redirect:/game/"; }
From source file:org.wallride.web.controller.admin.user.UserInvitationResendController.java
@RequestMapping public String save(@PathVariable String language, @Valid @ModelAttribute("form") UserInvitationResendForm form, BindingResult result, String query, AuthorizedUser authorizedUser, RedirectAttributes redirectAttributes) throws MessagingException { UserInvitation invitation = userService.inviteAgain(form.buildUserInvitationResendRequest(), result, authorizedUser);/*from w w w . j ava 2 s . com*/ redirectAttributes.addFlashAttribute("resentInvitation", invitation); redirectAttributes.addAttribute("query", query); return "redirect:/_admin/{language}/users/invitations/index"; }