title: Spring MVC JSP Form not pre-populating (or just back)
body: <p>I am new to Spring MVC (and front end for that matter). I have a jsp with a form on. In my controller's GET method I add the command to the ModelMap. The page does some validation (greys out things when checkboxes clicked, etc). Then I go to the next page. The user is suppose to be able to click the back button (which is wired up in an  tag - for graphics reasons apparently) and then make changes to their form. Except...the form is empty. </p>
  
  <p>So my main question - what is the best way to go back (to my .do) and retain all the values in the form? There are some things that runs on my GET method...so this still needs to happen. </p>
  
  <p>What I tried: I read somewhere that the command is suppose to pre-populate the form? So I allready have a command which I use to get the info....this is what I did (but it doesn't work). (I debugged and the command is populated with the values)</p>
  
  <pre><code>&lt;form class="form-horizontal" commandName="myCommand" name="formdetail" id="formdetail" method="post"&gt;
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>@RequestMapping(method = RequestMethod.POST)
  public View handleSubmit(@ModelAttribute MyCommand myCommand, BindingResult result, HttpServletRequest aHttpServletRequest){
  </code></pre>
  
  <p>WebUtils.setSessionAttribute(aHttpServletRequest, "goalDetailCommand", goalDetailCommand);
  //Then do some redirecting</p>
  
  <pre><code>@RequestMapping(method = RequestMethod.GET)
  public String show(ModelMap model, HttpServletRequest aHttpServletRequest, @ModelAttribute MyCommand myCommand) throws Exception {
      myCommand = (MyCommand)WebUtils.getSessionAttribute(aHttpServletRequest, "myCommand");
      model.addAttribute("myCommand", myCommand);
  </code></pre>
  
  <p>Thanks</p>
  
  <p>EDIT:
  I didn't have the path part in. Added it but still no luck. Is something else wrong?                                                              </p>
  
  <pre><code>&lt;input type="text" class="amount input-medium" path= "amountToSave" id="amountToSave" name="amountToSave" placeholder="0000.00"&gt;
  </code></pre>