title: Do session attributes show in URL when handling post redirect in Spring MVC 3?
body: <p>I am handling forms in Spring MVC and I submitted a form and I am trying to redirect the post request to avoid resubmitting the form with refresh button.</p>
  
  <p>But I need a dynamically generated value to be displayed based on the form submission in the redirected page. So I am saving that value in session in the post handler method and getting it back in the redirected page handling method.</p>
  
  <p>Would I get the session attribute shown displayed in the redirected page like request parameters in GET method case?</p>
  
  <p>Following is the code that I am using:</p>
  
  <p><strong>This method is handling the form submission</strong></p>
  
  <pre><code>@RequestMapping(value="/something", method=RequestMethod.POST) 
  public String testStopped(Model model, WebRequest request, HttpSession session) {
      //...
      int foo = 1234;//some dynamically generated value
      session.setAttribute("foo", foo);
      return "redirect:/something/somethingelse";
  }
  </code></pre>
  
  <p><strong>This method is handling the redirected page</strong></p>
  
  <pre><code>@RequestMapping(value="/something/somethingelse") 
  public String testStopped(Model model, HttpSession session) {
      ...
      Integer kungfoo = (Integer) session.getAttribute("foo");
      model.addAttribute("kungfoo", kungfoo);
      return "somethingelse";
  }
  </code></pre>
  
  <p>This is the url I end up with after redirect: <a href="http://wikedlynotsmart.com/something/somethingelse?kungfoo=1234" rel="nofollow">http://wikedlynotsmart.com/something/somethingelse?kungfoo=1234</a></p>
  
  <p>Is there a way to for <code>?kungfoo=1234</code> not to be displayed at the end and still get it passed to the redirect request handler method?</p>
  
  <p>Is this how it is supposed to work or I am committing a blunder somewhere? Could someone help me understand it?</p>
  
  <p>Thanks.</p>