title: How to pass requestparam to another method in spring
body: <p>I'm trying to pass my parameters to another method and save it to my respective repositories. I want to pass my parameters in <code>checkoutView</code> to <code>doOrder</code>. How do I do that?</p>
  
  <p>Here's my Controller code:</p>
  
  <pre><code>@Controller
  @RequestMapping(value = "/checkout")
  public class CheckoutController {
  
  
  @Autowired
  ProductRepository pRepo;
  
  @Autowired
  CustomerRepository cRepo;
  
  @Autowired
  InventoryRepository iRepo;
  
  @RequestMapping(value = "", method=RequestMethod.POST)
  public ModelAndView checkoutView(@RequestParam(value="val-name") String prodname, @RequestParam(value="val-qty") int qty, @RequestParam(value="val-price") double price, @RequestParam(value="amount") String amount) {
      ModelAndView mav = new ModelAndView();
      mav.addObject("customerEntity", new CustomerEntity());
      mav.setViewName("/checkout");
      return mav;
  }
  
  @RequestMapping(value="/new",method = RequestMethod.POST)
  public String doOrder(@ModelAttribute CustomerEntity customerEntity, @ModelAttribute ProductEntity productEntity) {
  //perform a save to their repositories
      return "redirect:/product-list";
    }
  
  }
  </code></pre>