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:com.wury.app.controller.LoginController.java

@RequestMapping(value = "login-fail", method = RequestMethod.GET)
public String loginFail(RedirectAttributes attributes) {
    attributes.addFlashAttribute("success", false);
    return "redirect:login";
}

From source file:cherry.sqlapp.controller.login.LoginControllerImpl.java

@Override
public ModelAndView loginFailed(Locale locale, SitePreference sitePref, HttpServletRequest request,
        RedirectAttributes redirAttr) {

    redirAttr.addFlashAttribute(PathDef.METHOD_LOGIN_FAILED, true);

    UriComponents uc = fromMethodCall(on(LoginController.class).init(locale, sitePref, request)).build();

    ModelAndView mav = new ModelAndView();
    mav.setView(new RedirectView(uc.toUriString(), true));
    return mav;// w  ww . j  a  va2s  .  c o m
}

From source file:cherry.sqlapp.controller.login.LoginControllerImpl.java

@Override
public ModelAndView loggedOut(Locale locale, SitePreference sitePref, HttpServletRequest request,
        RedirectAttributes redirAttr) {

    redirAttr.addFlashAttribute(PathDef.METHOD_LOGGED_OUT, true);

    UriComponents uc = fromMethodCall(on(LoginController.class).init(locale, sitePref, request)).build();

    ModelAndView mav = new ModelAndView();
    mav.setView(new RedirectView(uc.toUriString(), true));
    return mav;// w  w  w .j a  v a2s  .  c o  m
}

From source file:sample.web.order.OrderController.java

protected String fillMessageAndredirectToIndex(RedirectAttributes redirectAttributes) {
    redirectAttributes.addFlashAttribute("message", "Your Cart is Empty.");
    return "redirect:/";
}

From source file:controllers.parent.WebController.java

protected void addErrors(RedirectAttributes ra, ServiceResult res) {
    ra.addFlashAttribute(ERRORS_LIST_NAME, res.getErrors());
}

From source file:net.jeeshop.web.controller.BaseController.java

protected void addMessage(RedirectAttributes flushAttrs, String message) {
    flushAttrs.addFlashAttribute("message", message);
}

From source file:net.jeeshop.web.controller.BaseController.java

protected void addWarning(RedirectAttributes flushAttrs, String warning) {
    flushAttrs.addFlashAttribute("warning", warning);
}

From source file:net.jeeshop.web.controller.BaseController.java

protected void addError(RedirectAttributes flushAttrs, String warning) {
    flushAttrs.addFlashAttribute("errorMsg", warning);
}

From source file:nu.yona.server.admin.SystemMessageController.java

@RequestMapping(value = "/", method = RequestMethod.POST)
public String addSystemMessage(@RequestParam String message, RedirectAttributes redirectAttributes) {
    batchProxyService.sendSystemMessage(message);

    redirectAttributes.addFlashAttribute("flashMessage", "System message sent successfully");
    return "redirect:/systemMessages/";
}

From source file:com.jd.jr.chapter5.pjax.PjaxFormController.java

@RequestMapping(value = "/edit", method = RequestMethod.POST)
public String edit(@RequestHeader(value = "X-PJAX", defaultValue = "false") boolean isPjax, Model model,
        RedirectAttributes redirectAttributes) {

    if (!isPjax) {
        redirectAttributes.addFlashAttribute("message", "?");
        return "redirect:/form";
    } else {/*  w  w  w  . j a  v  a2s.c  om*/
        model.addAttribute("message", "?");
        return "form/index_fragment";
    }
}