Home Spring Spring3.2 The options tag

Related Tutorials


 
 

Share on Google+Share on Google+

The options tag

Advertisement
In this section, you will learn about the options tag of Spring form tag library.

The options tag

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

The options tag renders a list of HTML 'option' tags. It sets the 'selected' attribute on the appropriate option based on the bound value.

Sample code is shown below :

<tr>
	<td>Country:</td>
	<td>
		<form:select path="country">
			<form:option value="-" label="--Please Select"/>
			<form:options items="${countryList}" itemValue="code" itemLabel="name"/>
		</form:select>
	</td>
</tr>

This will render the following HTML :

<tr>
	<td>State:</td>
	<td>
	<select name="state">
		<option value="-" >--Please Select</option>
		<option value="UP">Uttar Pradesh</option>
		<option value="MP">Madhya Pradesh</option>
		<option value="AP">Arunachal Pradesh</option>
		<option value="HP">Himachal Pradesh</option>
	</select>
	</td>
</tr>

 

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 22, 2013

Related Tutorials

Discuss: The options tag  

Post your Comment


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