126
Spring MVC Form Drop-Down List
The Spring MVC form drop-down list contains the list of elements. This tag generates an HTML select element. It allows data binding to the selected element.
Syntax
Here are some other tags used to select the options.
option tag
This tag generates an HTML option tag. Each tag contains a value that can be selected by the user.
Syntax
options tag
This tag generates a list of HTML option tags. Each tag contains a list of elements selected by the user.
Syntax
Example of Spring MVC Form Drop-Down List
1. Add dependencies to pom.xml file.
2. Create the bean class
Reservation.java
3. Create the controller class
ReservationController.java
4. Provide the entry of controller in the web.xml file
web.xml
5. Define the bean in the xml file
spring-servlet.xml
6. Create the requested page
index.jsp
7. Create the view components
reservation-page.jsp
confirmation-page.jsp
Output:
Next TopicMVC CRUD Example