In the following scenario, these assumptions are made.
- An attribute named "aisles" is stored as an attribute in the ServletContext.
- "aisles" is a HashMap. The key is the aisle Id, while the value is the aisle's description. For example, the key = "1", and the value = "Dairy".
<html:select property="aisleId">
<html:options collection="aisles" property="key" labelProperty="value" />
</html:select>
This will generate HTML similar to the following:
<select name="aisleId">
<option value="1">Dairy</option>
<option value="2">Frozen Foods</option>
<option value="3">Beverages</option>
<option value="4">Breakfast Foods</option>
<option value="5">Snacks, Cookies, & Candy</option>
<option value="6">Grains & Pastas</option>
<option value="7">Soups & Canned Goods</option>
<option value="8">Baking Goods</option>
<option value="9">Condiments</option>
</select>
1 comment:
Thank you very much, an excelent guide.
Post a Comment