
Hi, How can I add elements of an ArrayList to HTML combobox or list in java? Hi, You can use the following code: Array List Example

Hi,
You can use the following code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Array List Example</TITLE>
</HEAD>
<select size="1" name="MYLIST">
<%
ArrayList a_list = new ArrayList ();
for (Iterator it = a_list.iterator (); it.hasNext (); ) {
MyClass obj = (MyClass)it.next ();
%>
<option value="<%=obj.getId()%>"><%=obj.getValue()%></option>
<%
}
%>
</select>
<BODY>
</BODY>
</HTML>
Thanks
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.