Share on Google+Share on Google+

@RequestParam Annotation

In this tutorial you will learn about @RequestParam Annotation

@RequestParam Annotation

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


Posted on: May 17, 2012 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.