Spring MVC Controller: Redirect without parameters being added to my url

In Spring 3.1 a preferred way to control this behaviour is to add a RedirectAttributes parameter to your method:

@RequestMapping("save/")
public String doSave(..., RedirectAttributes ra)
{
    ...
    return "redirect:/success/";
}

It disables addition of attributes by default and allows you to control which attributes to add explicitly.

In previous versions of Spring it was more complicated.

Leave a Comment