May 2015
Intermediate to advanced
234 pages
4h 18m
English
To display a form and retrieve the data the user entered when it's submitted, use a first controller method to display the form. Use a second controller method to process the form data when the form is submitted.
Here are the steps to display and process a form:
@RequestMapping("/addUser")
public String addUser() {
return "addUser";
}<form method="POST"> <input type="text" name="firstName" /> <input type="submit" /> </form>
@RequestMapping(value="/addUser", method=RequestMethod.POST) public String addUserSubmit(HttpServletRequest request) { String firstName ...Read now
Unlock full access