I have two arraylists in my class and I want to send it to my JSP and then iterate the elements in arraylist in a select tag.
Here is my class:
packa
There are multiple ways this can be done (with some changes in your scheme)
Using JSTL:
Create a bean with two fields as food and food_code
public class Food{ private String food; private String food_code; // Setter/getters follows }
Now the arraylist available on the page will be list Food objects.
In the JSP code, you can use following:
If you are using struts:
Here list is object key which will be used to retrieve the list from context (page/session)