C
Christine Mayer
Hi,
I've got an object that contains 2 attributes - a String and a map,
which contains a set of Strings.
I want to iterate over these objects, and so I also want to iterate
over the map, and print out key and value.
I've read this wasn't possible and one should instead iterate over the
values, something like:
<c:forEach var="loop" items="${hashmap.values}"
But that just isn't what I need - I need both, key and value. I know I
could also just as well create a proprietary object that contains 2
Strings each - but imho in this case this is just too much overhead.
What can you recommend me to do? Maybe I should write a method into my
bean "getNextKey" and "getNextValue - the problem is if someone would
call "getNextKey" on the view twice then the keys and values wouldn't
mach anymore - in otherwise I would like to leave the control of the
map to Java...
Thanks in advance,
Christine
I've got an object that contains 2 attributes - a String and a map,
which contains a set of Strings.
I want to iterate over these objects, and so I also want to iterate
over the map, and print out key and value.
I've read this wasn't possible and one should instead iterate over the
values, something like:
<c:forEach var="loop" items="${hashmap.values}"
But that just isn't what I need - I need both, key and value. I know I
could also just as well create a proprietary object that contains 2
Strings each - but imho in this case this is just too much overhead.
What can you recommend me to do? Maybe I should write a method into my
bean "getNextKey" and "getNextValue - the problem is if someone would
call "getNextKey" on the view twice then the keys and values wouldn't
mach anymore - in otherwise I would like to leave the control of the
map to Java...
Thanks in advance,
Christine