How to populate a drop down using string array list

Struts 1.x :
How to populate a dropdown using string array list?
In the form bean (formbean) there are getter and setter methods for the list “blockIds” which is an string arraylist. For an example

ArrayList<String> blockIds = new ArrayList<String>();
blockIds.add("A");
blockIds.add("B");

What would be the jsp code which should look like the following after rendering.

<select name=“selectedItem”>
    <option value=“A”>A</option>
    <option value=“B”>B</option>
</select>


Source: jsp

Leave a Reply