how to add arraylist in Jsp
java, jsp
Solution
EDITED
Try this:
<%
ArrayList al = new ArrayList();
al.add("C");
al.add("A");
al.add("E");
al.add("B");
al.add("D");
al.add("F");
%>
<select>
<% for(int i = 0; i < al.size(); i++) {
String option = (String)al.get(i);
%>
<option value="<%= option %>"><%= option %></option>
<% } %>
</select>
</body>
</html>
Problem
``` <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <%=new Date() %> <% ArrayList al = new ArrayList(); al.add("C"); al.add("A"); al.add("E"); al.add("B"); al.add("D"); al.add("F"); %> <select> <option value="<%=al%>"></option> </select> </body> </html> ``` This is my code i want to add Arraylist in drop down in Jsp I dont know how to Bind arraylist in html obtion or drop down please help me i have tried Much but unable to do this .