Home Tutorial Spring @RequestParam Annotation

 
 

Share on Google+Share on Google+
@RequestParam Annotation
Posted on: May 17, 2012 at 12:00 AM
Advertisement
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

Advertisement

Related Tags for @RequestParam Annotation:


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.

Posted on: May 17, 2012

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com