Spring MVC Form Tag Library

Since Spring 2.0, Spring provides set of data binding-aware tags for handling form elements when using JSP and Spring Web MVC. Each tag provides support for the set of attributes of its corresponding HTML tag counterpart, making the tags familiar and intuitive to use.

The form tag library is bundled in spring.jar and the descriptor is called spring-form.tld. In order to use the tags in your form we need to include the below taglib in our JSP Page.

<%@ taglib prefix=”form” uri=”http://www.springframework.org/tags/form” %>

Spring MVC Textbox Example

We will be using <form:input/> tag to render a Textbox in the jsp

Spring MVC Password Example

We will be using <form:password/> tag to render a Password field in the jsp

Spring MVC Dropdown Box Example

We will be using <form:select/> tag to render a Dropdown Box in the jsp

Spring MVC Checkbox And Checkboxes Example

We will be using <form:checkbox/> and  <form:checkboxes/>tag to render single and multiple checkboxes in the jsp

Spring MVC Radiobutton And Radiobuttons Example

We will be using <form:radiobutton/> and  <form:radiobuttons/>tag to render single and multiple radio buttons in the jsp

Spring MVC TextArea Example

We will be using <form:textarea/> tag to render a TextArea in the jsp

Spring MVC HiddenValue Example

We will be using <form:hidden/> tag to render a Hidden Field in the jsp