user871611 user871611 - 1 year ago 217
Java Question

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

I'm trying to redirect without parameters being added to my URL.

public class SomeController
public String doSave(...)
return "redirect:/success/";

public String doSuccess(...)
return "success";

After a redirect my url looks always something like this:
Since I want my URLs to be kind of RESTful and I never need the params after a redirect, I don't want them to be added on a redirect.

Any ideas how to get rid of them?

Answer Source

In Spring 3.1 use option ignoreDefaultModelOnRedirect to disable automatically adding model attributes to a redirect:

<mvc:annotation-driven ignoreDefaultModelOnRedirect="true" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download