title: Refresh jsp page from Spring Controller
body: <p>I'm having problem with refreshing my jsp page after calling Spring controller. 
  In my index page, I have login, and after the user enter username and password, the form gets submitted to the controller and then validate and create new user session. After all this, my page is refreshed and everything is working fine. The problem occur when I implement logic for changing page language. I'm doing the same but this time, the page is not refreshing! 
  Here is what I have tried so far: </p>
  
  <p><strong>JAVA CODE:</strong></p>
  
  <pre><code>    @RequestMapping(value="/index", method=RequestMethod.GET)
  public String initializeIndex(ModelMap model) {                 
      // IMPLEMENT SOME BUSINESS LOGIC HERE
      String l = (String) model.get("language");
  
      if (l == null) {
          l = "English";  //Default  
      }
  
      model.addAttribute("currentLanguage", l);
      return "index";
  }
  
  /**
   * When the user login.
   * 
   * @param model
   * @return
   */
  @RequestMapping(value="/welcome", method=RequestMethod.POST)
  public String login(ModelMap model) {
  
      // IMPLEMENT SOME BUSINESS LOGIC HERE
  
      return "redirect:/index";
  }
  
  /**
   * When the user change website language.
   * 
   * @param model
   * @return
   */
  @RequestMapping(value="/changeLanguage", method=RequestMethod.POST)
  public String changeLanguage(@RequestParam String language, ModelMap model) {
  
      //CHANGE SITE LANGUAGE...
  
      model.addAttribute("language", language);           
  
      return "redirect:/index";
  }
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Here is how I'm calling /changeLanguage method. This function is called after a button click event. </p>
  
  <p><strong>JS</strong></p>
  
  <pre><code>function changeLanguage(language) {
  $.ajax({
      type: "POST",
      url: "changeLanguage",
      data: "language=" + language,
      success: function(){
        alert($('#languageHolder').val());
      } 
      }
  });
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;input type="hidden" id="languageHolder" value='&lt;c:out value="${currentLanguage}" /&gt;'/&gt;
  </code></pre>
  
  <p>Now when I debug the app, I see that everything is working perfect. The only difference is that when call /welcome method and the redirect to /index method, after that the index.jsp is refreshed and when call /changeLanguage method and then to /index method, the index.jsp is not refreshed.</p>
  
  <p>One other difference is that on login I user form and submit the form. In change language I use ajax to submit the data to the server. Could this be the problem ? 
  Any help will be appreciated.</p>
  
  <p><strong>EDIT</strong>
  I had just made some small experiments: I add one holder in my index.jsp 
  and then in the controller I'm setting "language" variable to this holder. Then I
  alert this value in js and observe the result. 
  I just edit the code above. 
  What I observe is that the JAVA code is working perfect - e.g. when there is no language set in the model, it set the default "English" and set it to the model. Also when there is such attribute, I uses it and set the new value to the model. BUT in the js, alert is always print "English" ???</p>