HTML Forms

Learn how to read and process form data in Spring MVC application.

In this lesson, we will set up a form, which will prompt the user to enter a player’s name. When the user clicks the ”Submit” button, our Spring MVC application will show a page containing the name entered by the user. Later, we will add functionality to show details of the player entered by the user.

A controller can have multiple request mappings. We will create a PlayerController to handle different request mappings. This controller will map the URL showPlayerForm to a method that displays the form and processPlayerForm to a method that directs the user to the player details page.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.