I have an arraylist(which itself stores 6 arraylists ) in my servlet class. I am passing this arraylist to a jsp where I want to access the elements which are stored in the inner arraylists individually. I am able to iterate the outer arraylist but when I try to iterate the inner arraylists, I am not able to do it.....please help. Any help will be appreciated. Thanks in advance.
Asked
Active
Viewed 60 times
-1
-
Use two nested JSTL `forEach` elements. – Sotirios Delimanolis Feb 13 '14 at 04:31
-
Hi Sotirios, thanks for the reply but can u please give an example code....as I am new to jstl....I was using scriplets in jsp. I know its noy good but I have a loose jand on jstl...plz help.. – user2609917 Feb 13 '14 at 04:37
-
[Here are a bunch of examples](http://stackoverflow.com/questions/2117557/how-to-iterate-an-arraylist-inside-a-hashmap-using-jstl). Modify them to fit the requirement of nested `ArrayList` objects. – Sotirios Delimanolis Feb 13 '14 at 04:38
1 Answers
-2
try like this, will help you:
for(ArrayList<myFirstType> list1: frstList){
for(ArrayList<mySecondType> list2: list1){
print-> list2
}
}

Ashish Ratan
- 2,838
- 1
- 24
- 50
-
1If you're going to provide code, make it compile. And put it in context. Is this meant to be a scriptlet? – Sotirios Delimanolis Feb 13 '14 at 06:52