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:cn.aozhi.songify.web.account.RegisterController.java

@RequestMapping(method = RequestMethod.POST)
public String register(@Valid User user, RedirectAttributes redirectAttributes) {
    accountService.registerUser(user);//w  ww. j a  va2  s  . co  m
    redirectAttributes.addFlashAttribute("username", user.getLoginName());
    return "redirect:/login";
}

From source file:com.diguage.wanwan.web.account.RegisterController.java

@RequestMapping(method = RequestMethod.POST)
public String register(@Valid User user, RedirectAttributes redirectAttributes) {
    accountService.registerUser(user);//ww  w. j  av a2 s  .  c om
    redirectAttributes.addFlashAttribute("username", user.getUserName());
    return "redirect:/login";
}

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

@RequestMapping(method = RequestMethod.POST)
public String register(@Valid Account user, RedirectAttributes redirectAttributes) {
    accountService.registerUser(user);/*  w w w.ja v  a 2 s.  c  o m*/
    redirectAttributes.addFlashAttribute("username", user.getUsername());
    return "redirect:/login";
}

From source file:com.logsniffer.web.controller.sniffer.SnifferManageController.java

@RequestMapping(value = "/sniffers/{snifferId}", method = RequestMethod.POST)
String redirectAfterUpdate(@PathVariable("snifferId") final long snifferId,
        final RedirectAttributes redirectAttrs) {
    redirectAttrs.addFlashAttribute("message", "Changes applied successfully!");
    return "redirect:{snifferId}";
}

From source file:org.wallride.web.controller.guest.user.SignupController.java

@RequestMapping(method = RequestMethod.POST)
public String signup(@Valid @ModelAttribute("form") SignupForm form, BindingResult errors,
        RedirectAttributes redirectAttributes) {
    redirectAttributes.addFlashAttribute(FORM_MODEL_KEY, form);
    redirectAttributes.addFlashAttribute(ERRORS_MODEL_KEY, errors);

    if (errors.hasErrors()) {
        return "redirect:/signup?step.edit";
    }/*from ww  w .j ava  2  s  .c o  m*/

    try {
        signupService.signup(form.toSignupRequest(), User.Role.VIEWER);
    } catch (DuplicateLoginIdException e) {
        errors.rejectValue("loginId", "NotDuplicate");
        return "redirect:/signup?step.edit";
    } catch (DuplicateEmailException e) {
        errors.rejectValue("email", "NotDuplicate");
        return "redirect:/signup?step.edit";
    }

    redirectAttributes.getFlashAttributes().clear();
    return "redirect:/";
}

From source file:com.lynn.controller.Modal1.java

@RequestMapping("/flash.do")
public String flash(RedirectAttributes redirectAttributes) {
    redirectAttributes.addFlashAttribute("username", "");
    redirectAttributes.addFlashAttribute("username1", "Biao");
    return "redirect:flash2.do";
}

From source file:com.logsniffer.web.controller.source.SourcesManageController.java

@RequestMapping(value = "/sources/{logSource}", method = RequestMethod.POST)
String redirectAfterUpdate(@PathVariable("logSource") final long logSourceId,
        final RedirectAttributes redirectAttrs) {
    redirectAttrs.addFlashAttribute("message", "Changes applied successfully!");
    return "redirect:{logSource}";
}

From source file:$.RegisterController.java

@RequestMapping(method = RequestMethod.POST)
    public String register(@Valid User user, RedirectAttributes redirectAttributes) {
        accountService.registerUser(user);
        redirectAttributes.addFlashAttribute("username", user.getLoginName());
        return "redirect:/login";
    }//from  w  ww . j  a  v a  2 s  .  c  om

From source file:ph.fingra.statisticsweb.controller.SignupController.java

@RequestMapping(method = RequestMethod.POST, value = "/signup")
public String signup(@Valid Member member, BindingResult bindingResult, RedirectAttributes ra) {

    memberService.create(member);/*from   w  ww.j a v  a  2  s. c  o  m*/
    ra.addFlashAttribute("member", member);

    return "redirect:/signup/result";
}

From source file:com.fengduo.spark.web.controller.account.LoginController.java

@RequestMapping(value = "/register", method = RequestMethod.POST)
public String register(@Valid User user, RedirectAttributes redirectAttributes) {
    accountService.registerUser(user);// w w  w .jav a  2s  . co  m
    redirectAttributes.addFlashAttribute("username", user.getLoginName());
    return "redirect:/login";
}