This @RequestParam annotation can be used for getting the parameters from the request as,
/*
* The method written below takes the request parameters individually by
* using @RequestParam However you can also use @ModelAttribute to take the
* form/model object.
*/
@RequestMapping(value = "/process-form")
public String processForm(
@RequestParam(value = "rollNo") Integer rollNo,
@RequestParam(value = "name") String name,
@RequestParam(value = "address") String address,
@RequestParam(value = "commonsMultipartFile") CommonsMultipartFile commonsMultipartFile,
Model model) {
model.addAttribute("rollNo", rollNo);
model.addAttribute("name", name);
model.addAttribute("address", address);
model.addAttribute("multipartFile", commonsMultipartFile);
return "view-data";
}
You can download the complete source code from here