Javatpoint Logo
Javatpoint Logo

Spring MVC Form Text Field

The Spring MVC form text field tag generates an HTML input tag using the bound value. By default, the type of the input tag is text.


Here, path attribute binds the form field to the bean property.

The Spring MVC form tag library also provides other input types such as email, date, tel, etc.

For email:

For date:

Example of Spring MVC Form Text Field

Let's see an example to create a railway reservation form using form tag library.

1. Add dependencies to pom.xml file.

2. Create the bean class

Here, the bean class contains the variables (along setter and getter methods) corresponding to the input field exist in the form.

3. Create the controller class

4. Provide the entry of controller in the web.xml file


5. Define the bean in the xml file


6. Create the requested page


7. Create other view components


Note - The value passed with the @ModelAttribute annotation should be the same to the modelAttribute value present in the view page.



Spring MVC Form Text Field
Spring MVC Form Text Field
Spring MVC Form Text Field
Spring MVC Form Text Field
Next TopicForm Radio Button

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA