I am using Struts 1.2. I have one ArrayList and one HashMap in my form bean. Name of these collection are myList and myMap. Form bean name is myForm and scope is request.
I would like to know how to display values from arraylist and hashmap to <html:select> tag for creating drop down list.
There's an easier way to do this using the html:optionsCollection tag. Below is an example using both a list and a map.
List example:
The above assumes that myList is a list of JavaBeans, each having a propertyUsedForLabel and a propertyUsedForValue property.
Map Example:
The above assumes the key of each map entry is the code you want sent to the server if the option is selected and the value of the map entry is the label you want displayed for the option.