@RequestMapping(“/process-formV3”)
public String getProcessFormV2(HttpServletRequest request, Model model) {
String name = request.getParameter(“student”);
name = "Yo! " + name.toUpperCase();
model.addAttribute("message", name);
return "process-form";
}In this method we get the parameter value using request.getParameter but there is a shortcut in doing this, how ?
@RequestMapping(“/process-formV3”)
public String getProcessFormV2(@RequestParam(“student”) String name, Model model) {
name = "Yo! " + name.toUpperCase();
model.addAttribute("message", name);
return "process-form";
}//FormController
@Controller
public class FormController {@RequestMapping("/form")
public String showForm() {
return "form";
}//SillyController
@Controller
public class SillyController {@RequestMapping("/form")
public String showForm() {
return "silly";
}}
@Controller
@RequestMapping(“/hello”)
public class FormController {
@RequestMapping("/form")
public String showForm() {
return "form";
}This should be also modified in //home.jsp file
<h1>Home</h1>
<a href="hello/form">Go to form</a>