@RequestParam
@Controller
public class StudentAdmissionController {
@RequestMapping(value="/admissionForm.html", method = RequestMethod.GET)
public ModelAndView getAdmissionForm() {
ModelAndView model = new ModelAndView("AdmissionForm");
return model;
}
@RequestMapping(value="/submitAdmissionForm.html", method = RequestMethod.POST)
public ModelAndView submitAdmissionForm(@RequestParam Map<String,String> reqPar) {
String name = reqPar.get("studentName");
String hobby = reqPar.get("hobby");
ModelAndView model = new ModelAndView("AdmissionSuccess");
model.addObject("msg","Details submitted by you:: Name: "+name+ ", Hobby: " + hobby);
return model;
}
}