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

java, spring-mvc

Solution

You can simply clear the `Model` map in your `Controller` method before redirect .

model.asMap().clear();
return "redirect:" + yourURL;

Don't expose the model attributes at all.

RedirectView view = new RedirectView(yourURL, true);
view.setExposeModelAttributes(false);
return new ModelAndView(view); 

Hope this link helps you in finding a better solution, specially point (4) `HandlerInterceptor` for common reference data within the entire web application

Problem

I'm trying to redirect without parameters being added to my url. I mean after a redirect, my url looks like this: .../success/?param1=xxx&param2=xxx. This issue is exactly the same as this Spring MVC Controller: Redirect without parameters being added to my url The response https://stackoverflow.com/a/16841663/384984 is what I'm looking (ignoreDefaultModelOnRedirect). The problem is that I'm using Spring 3.0. How can I solve it with this Spring version?

Original source

Related problems