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¶m2=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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With