title: removing GET parameters from URL Spring 4
body: <p>I have multilanguage installed on my spring app, and I don't want the 'lang' parameter to appear in the URL (I'm storing the locale with sessionLocaleResolver or cookieLocaleResolver/neither works).
  I've searched for hours to find a solution to this issue, although apparently it should already be working with what I've done. Here's my code : </p>
  
  <p>The view (welcome.jsp) :</p>
  
  <pre><code>Language : &lt;a href="?lang=en"&gt;English&lt;/a&gt;|&lt;a href="?lang=fr_FR"&gt;Francais&lt;/a&gt;|&lt;a href="?lang=ro_RO"&gt;Romanian&lt;/a&gt;
  &lt;h2&gt;welcome.springmvc : &lt;spring:message code="welcome.text" text="default text" /&gt;&lt;/h2&gt;
  </code></pre>
  
  <p>My servlet.xml</p>
  
  <pre><code>    &lt;!-- Multi-Language / Localization Setup --&gt;
  &lt;mvc:interceptors&gt;
      &lt;mvc:interceptor&gt;
          &lt;mvc:mapping path="/**" /&gt;
          &lt;bean id="localeChangeInterceptor"
              class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"&gt;
              &lt;property name="paramName" value="lang" /&gt;
          &lt;/bean&gt;
      &lt;/mvc:interceptor&gt;
  &lt;/mvc:interceptors&gt;
  &lt;mvc:annotation-driven ignore-default-model-on-redirect="true" /&gt;
  
  &lt;bean id="messageSource"
      class="org.springframework.context.support.ReloadableResourceBundleMessageSource"&gt;
      &lt;property name="basenames"&gt;
          &lt;list&gt;
              &lt;value&gt;classpath:lang.files/welcome&lt;/value&gt;
              &lt;!-- &lt;value&gt;classpath:messages2&lt;/value&gt; --&gt;
          &lt;/list&gt;
      &lt;/property&gt;
      &lt;property name="defaultEncoding" value="UTF-8" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="localeResolver"
      class="org.springframework.web.servlet.i18n.CookieLocaleResolver"&gt;
      &lt;property name="defaultLocale" value="en" /&gt;
      &lt;property name="cookieName" value="lang" /&gt;
      &lt;property name="cookieMaxAge" value="60000" /&gt;
      &lt;property name="cookiePath" value="/" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>My Controller code - note that I'm staying in the same page when I click on the link to change the language. Because ideally it would be a dropdown, and I'd stay in the same page</p>
  
  <pre><code>@RequestMapping("/welcome")
  public ModelAndView helloWorld() {
  
      String message = "&lt;br/ &gt;&lt;div style='text-align:center;'&gt;"
              + "&lt;h3&gt;********** Hello World, Spring MVC Tutorial&lt;/h3&gt;&lt;/div&gt;&lt;br /&gt;";
  
      ModelAndView mv = new ModelAndView();
      // ModelAndView mv = new ModelAndView(new
      // RedirectView("welcome.do", true, true, true));
      RedirectView view = new RedirectView("/welcome", true);
      view.setExposeModelAttributes(false);
      mv.setView(view);
  
      mv.addObject("message", message);
      mv.addObject("activities", activityService.getAll());
      mv.addObject("act", activityService.getR());
  
      return new ModelAndView(view);
  }
  </code></pre>
  
  <p>The result is a '404' saying that 'localhost/myapp/welcome' is not found.</p>
  
  <p>Finally this the controller, working, but adding the 'lang' parameter in the URL : </p>
  
  <pre><code>@RequestMapping("/welcome")
  public ModelAndView helloWorld() {
  
      String message = "&lt;br/ &gt;&lt;div style='text-align:center;'&gt;"
              + "&lt;h3&gt;********** Hello World, Spring MVC Tutorial&lt;/h3&gt;&lt;/div&gt;&lt;br /&gt;";
  
      ModelAndView mv = new ModelAndView();
  
      mv.addObject("message", message);
      mv.addObject("activities", activityService.getAll());
      mv.addObject("act", activityService.getR());
  
      return mv;
  }
  </code></pre>
  
  <p>Please help.
  Thanks :)</p>