Example usage for org.springframework.web.servlet.mvc.support RedirectAttributes addFlashAttribute

List of usage examples for org.springframework.web.servlet.mvc.support RedirectAttributes addFlashAttribute

Introduction

In this page you can find the example usage for org.springframework.web.servlet.mvc.support RedirectAttributes addFlashAttribute.

Prototype

RedirectAttributes addFlashAttribute(String attributeName, @Nullable Object attributeValue);

Source Link

Document

Add the given flash attribute.

Usage

From source file:eu.scidipes.toolkits.pawebapp.web.UserManagementController.java

@RequestMapping(value = "/delete", method = POST)
public String delete(final String delusername, final Model model, final RedirectAttributes redirectAttrs) {

    userRepo.delete(delusername);/*from  ww w. j  a  v a  2 s .c o m*/
    redirectAttrs.addFlashAttribute("msgKey", "users.management.edit.deleted");
    return "redirect:/admin/users";
}

From source file:cn.aozhi.songify.web.music.MusicController.java

@RequestMapping(value = "create", method = RequestMethod.POST)
public String create(@Valid Music newMusic, RedirectAttributes redirectAttributes) {
    musicService.saveMusic(newMusic);/*from   ww w.ja  v  a 2  s. c o m*/
    redirectAttributes.addFlashAttribute("message", "?");
    return "redirect:/music/";
}

From source file:com.oakhole.auth.web.UserController.java

@RequestMapping(value = "create", method = RequestMethod.POST)
public String create(@Valid User user, RedirectAttributes redirectAttributes) {
    this.userService.save(user);
    redirectAttributes.addFlashAttribute("message", "?");
    redirectAttributes.addFlashAttribute("returnStatus", "success");
    return "redirect:/user";
}

From source file:com.oakhole.auth.web.UserController.java

@RequestMapping(value = "update", method = RequestMethod.POST)
public String update(@Valid @ModelAttribute(value = "user") User user, RedirectAttributes redirectAttributes) {
    this.userService.save(user);
    redirectAttributes.addFlashAttribute("message", "?");
    redirectAttributes.addFlashAttribute("returnStatus", "success");
    return "redirect:/user";
}

From source file:com.oakhole.sms.web.SmsReceiveController.java

@RequestMapping(value = "create", method = RequestMethod.POST)
public String create(@Valid SmsReceive smsReceive, RedirectAttributes redirectAttributes) {
    this.smsReceiveService.save(smsReceive);
    redirectAttributes.addFlashAttribute("message", "?");
    redirectAttributes.addFlashAttribute("returnStatus", "success");
    return "redirect:/smsReceive";
}

From source file:controllers.ColorController.java

@RequestMapping("/updateFromXml")
public String updateFromXml(Map<String, Object> model,
        @RequestParam(value = "xlsFile", required = false) MultipartFile file, RedirectAttributes ras) {
    if (file == null || file.isEmpty()) {
        ras.addFlashAttribute("error", "File not found");
    } else {/*  ww  w . j ava 2s  . c om*/
        File newFile = new File("/usr/local/etc/Color");
        if (newFile.exists()) {
            newFile.delete();
        }
        try {
            FileUtils.writeByteArrayToFile(newFile, file.getBytes());
            colorService.updateFromXml(newFile);
            ras.addFlashAttribute("error", colorService.getResult().getErrors());
        } catch (Exception e) {
            ras.addFlashAttribute("error", "updateFromXml" + e.getMessage());
        }
        if (newFile.exists()) {
            newFile.delete();
        }
    }
    return "redirect:/Color/show";
}

From source file:com.iscas.rent.web.account.UserAdminController.java

@RequestMapping(value = "delete/{id}")
public String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttributes) {
    Account user = accountService.getUser(id);
    accountService.deleteUser(id);//from  www  .  j av  a 2  s  .c  om
    redirectAttributes.addFlashAttribute("message", "" + user.getUsername() + "?");
    return "redirect:/admin/user";
}

From source file:com.jdonee.insight.web.account.UserAdminController.java

@RequestMapping(value = "delete/{id}")
public String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttributes) {
    User user = accountService.getById(id);
    accountService.deleteUser(id);/*from   ww w  .j  a va 2 s  .  c o  m*/
    redirectAttributes.addFlashAttribute("message", "" + user.getLoginName() + "?");
    return "redirect:/admin/user";
}

From source file:com.oakhole.sms.web.SmsController.java

@RequestMapping(value = "delete/{id}")
public String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttributes) {
    this.smsService.remove(smsService.get(id));
    redirectAttributes.addFlashAttribute("message", "?");
    redirectAttributes.addFlashAttribute("returnStatus", "success");
    return "redirect:/sms";
}

From source file:com.oakhole.sms.web.SmsReceiveController.java

@RequestMapping(value = "update", method = RequestMethod.POST)
public String update(@Valid @ModelAttribute(value = "smsReceive") SmsReceive smsReceive,
        RedirectAttributes redirectAttributes) {
    this.smsReceiveService.save(smsReceive);
    redirectAttributes.addFlashAttribute("message", "?");
    redirectAttributes.addFlashAttribute("returnStatus", "success");
    return "redirect:/smsReceive";
}