Sunday, September 15, 2019

Spring MVC Form Tag Library

The Spring MVC form tags are the configurable and reusable building blocks for a web page. These tags provide JSP, an easy way to develop, read and maintain.
The Spring MVC form tags can be seen as data binding-aware tags that can automatically set data to Java object/bean and also retrieve from it. Here, each tag provides support for the set of attributes of its corresponding HTML tag counterpart, making the tags familiar and easy to use.

Configuration of Spring MVC Form Tag

The form tag library comes under the spring-webmvc.jar. To enable the support for form tag library, it is required to reference some configuration. So, add the following directive at the beginning of the JSP page:

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

List of Spring MVC Form Tags

Let's see some of the frequently used Spring MVC form tags.
Form TagDescription
form:formIt is a container tag that contains all other form tags.
form:inputThis tag is used to generate the text field.
form:radiobuttonThis tag is used to generate the radio buttons.
form:checkboxThis tag is used to generate the checkboxes.
form:passwordThis tag is used to generate the password input field.
form:selectThis tag is used to generate the drop-down list.
form:textareaThis tag is used to generate the multi-line text field.
form:hiddenThis tag is used to generate the hidden input field.

The form tag

The Spring MVC form tag is a container tag. It is a parent tag that contains all the other tags of the tag library. This tag generates an HTML form tag and exposes a binding path to the inner tags for binding.

Syntax

  1. <form:form action="nextFormPath" modelAttribute=?abc?>  
In the next section, we will learn more about each form tag.

No comments:

Post a Comment

How to DROP SEQUENCE in Oracle?

  Oracle  DROP SEQUENCE   overview The  DROP SEQUENCE  the statement allows you to remove a sequence from the database. Here is the basic sy...