title: Pass object from one controller action to another controller action in spring mvc3
body: <p>in my project i have one to many mapping between company and location.While adding location i want company object.
  I have two differnt controller for company and location</p>
  
  <p>In company Controller:<br>
      addCompany  </p>
  
  <pre><code>@RequestMapping(value = "/add", method = RequestMethod.POST)
  public String addCompany(@ModelAttribute("company")
  Company company, BindingResult result,Model model) {
      companyService.addCompany(company);
     return "companyPage";
    }
  </code></pre>
  
  <p>updateCompany</p>
  
  <pre><code>@RequestMapping(value = "/update", method = RequestMethod.POST)
  public String updateCompany(@ModelAttribute("company")
  Company company, BindingResult result,@RequestParam(value = "submitVal") String updateOrRestore
  ,Model model) {
  
      if (updateOrRestore.equalsIgnoreCase("update")) {
              companyService.updateCompany(company);
              model.addAttribute("location", new Location());
  
          } else if (updateOrRestore.equalsIgnoreCase("restore")) {
              Company prevCompany = companyService.restoreCompany();
              model.addAttribute("company", prevCompany);
              model.addAttribute("location", new Location());
          }
  
        return "companyPage";
  }
  </code></pre>
  
  <p>In location Controller:<br>
  addLocation</p>
  
  <pre><code>@RequestMapping(value="/addLocation", method = RequestMethod.POST )
  public String addLocation(@ModelAttribute("location")
  Location location,BindingResult reult, Model model){
      logger.info("Location is added"+location);
      //Here b4 adding location in db i want to set company obj
      //location.setCompany(company);
      locationService.addLocation(location);
  }
  </code></pre>
  
  <p>How can i get company object that one is save or updated in company controller action??</p>