Home Spring Spring3.2 The options tag



The options tag
Posted on: March 22, 2013 at 12:00 AM
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>

 

Related Tags for The options tag:


More Tutorials from this section

Ask Questions?    Discuss: The options tag  

Post your Comment


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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.