I have this problem..
In a JAVA class I have the below code
In a JSP, I have written a JSTL which is written this way,
So basically what I have is, a Hashmap which has String as a key and an ArrayList object as a value.
When I try to run this, I get the error cannot run forEach for "items".
What part of code am I not writing correctly? Please help.
Originally posted by seetharaman venkatasamy:
change your name from param to param1 or something else..because param is one of the implicit object in EL...more over for:Each items should be collection or array
Hope THis Helps
The one I have given above is just an example. I havent used param as I have given there. The variable names that I am using in my application is entirely different. For this example, you can assume it as "param1" as you have indicated.
Originally posted by Steve Luke:
When you iterate over a map you are iterating over the entry set, not the map directly. This means that each value returned by the outer loop is a MapEntry, not an ArrayList. The MapEntry would have a method getValue() which would return the ArrayList to use for the inner loop. Example:
Thank you very much. It is working fine now.