The checkboxes tag

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

Ads

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>

 

Advertisements

Ads
Share on Google+Share on Google+

The checkboxes tag

Posted on: March 22, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: The checkboxes tag  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads