title: Update a @ModelAttribute with existing values
body: <p><br>
  I want to know if there's a way to update a existing @ModelAttribute. If possible without keeping the values in session<br>
  Let us say I have a bean : <br></p>
  
  <pre><code>class TravelDetails{
      private String origin;
      private String destination;
      private String travelerName;
      private String travelerAge;
          // Getters &amp; Seters
  }
  </code></pre>
  
  <p>Here's my controller:</p>
  
  <pre><code>@Controller
  class TravelerController{
  
  @RequestMapping(value="/searchDetails", method=RequestMethod.GET)
  public ModelAndView getSearchDetails(@RequestParam("origin") String origin,
          @RequestParam("destination") String destination,ModelMap modelMap){
      TravelDetails travelDetails = new TravelDetails();
      travelDetails.setOrigin(origin);
      travelDetails.setDestination(destination);
      modelMap.addAttribute("travelDetails",travelDetails);
      return new ModelAndView("get_traveler_details");
      }
  
  @RequestMapping(value="/addTravelerDetails", method=RequestMethod.POST)
  public ModelAndView addTravelerDetails(
      @ModelAttribute("travelDetails") TravelDetails travelDetails,
             ModelMap modelMap){
      System.out.println(travelDetails.getOrigin);
      System.out.println(travelDetails.getDestination);
      System.out.println(travelDetails.getTravelerName);
      System.out.println(travelDetails.getTravelerAge);
      return new ModelAndView("get_traveler_details");
      }
     }
  </code></pre>
  
  <p>The the post form obtained in the second controller method only contains the traveler name and age while the origin and destination are required to be retrieved from the model attribute set in first controller.<br>
  I don't want to explicitly set set hidden fields in the Post form.
  <br>
  Let's assume my HTML be:<br></p>
  
  <pre><code>&lt;form:form modelAttribute="travelDetails" action="/addTravelerDetails" method="POST"&gt;
      &lt;form:input type="text" path="travelerName"/&gt;
      &lt;form:input type="text" path="travelerAge"/&gt;
  &lt;/form:form&gt;
  </code></pre>
  
  <p>Note : I'm writing the code on StackOverflow's text area and not on some IDE, so if there's some lame spelling or syntax error on code, please ignore. </p>