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:de.whs.poodle.controllers.student.McResultsController.java

@RequestMapping(method = RequestMethod.POST, params = "setPublic")
@PreAuthorize("@studentSecurity.hasAccessToMcWorksheet(authentication.name, #mcWorksheetId)")
public String makePublic(@ModelAttribute Student student, @PathVariable int mcWorksheetId,
        RedirectAttributes redirectAttributes) {
    mcWorksheetRepo.setWorksheetPublic(student.getId(), mcWorksheetId);
    redirectAttributes.addFlashAttribute("okMessageCode", "mcWorksheetMadePublic");
    return "redirect:/student/multipleChoiceResults/{mcWorksheetId}";
}

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

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

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

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

From source file:org.hdiv.spring.boot.sample.web.MainController.java

@RequestMapping(value = "/form", method = RequestMethod.POST)
String submit(@Valid @ModelAttribute FormBean bean, BindingResult bindingResult,
        RedirectAttributes redirectAttributes) {

    if (bindingResult.hasErrors()) {
        return "form";
    }/*from   w  w w .  j av a 2  s.  c o m*/
    redirectAttributes.addFlashAttribute("resultFormBean", bean);
    LOG.info("Name: " + bean.getName() + " Type: " + bean.getType());
    return "redirect:/form";
}

From source file:com.bangla.store.controller.EmployeeController.java

@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
public String deleteDetails(@PathVariable int id, Model model, RedirectAttributes rAttributes) {
    employeeService.delete(id);/*  w  w w  . j a va  2  s.co  m*/
    rAttributes.addFlashAttribute("message", "Successfully remoted item");
    return "redirect:/employee";

}

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

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

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

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

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

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

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

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

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

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