Big Data and Hadoop Training @$80 or Rs. 6,000 only - valid till Oct 17th Apply Now!

The checkboxes tag

Ads
 

The checkboxes tag

In this section, you will learn about checkboxes tag of Spring form tag library.

In this section, you will learn about checkboxes tag of Spring form tag library.

The checkboxes tag

In this section, you will learn about checkboxes tag of Spring form tag library.

The checkboxs tag of Spring form tag library provides multiple input tag of  type checkbox.

Consider a scenario where you need to create check boxes for category selection from list of categories. One way to implement this is to provide list of all the possible hobbies with checkbox tag of Form tag library.

But sometimes you not prefer to list all the possible categories in your JSP page. In spite of that you can provide a list of the available options at runtime and pass that in to the tag.

In the below code, categoryList, available as a model attribute, contains the list of available categories :

<form:form>
	<table>
		<tr>
			<td>Interests:</td>
			<td>
				<%-- Property is of an array or of type java.util.Collection --%>
				<form:checkboxes path="preferences.category" items="${categoryList}"/>
			</td>
		</tr>
	</table>
</form:form>

 

Ads

Ads