Oh, the joys of EL and Maps.
I'm gussing my code didn't originally work because framework.getId() returns an int? You can't put an int into a map. Your solution was to turn it into a
String, which you CAN put into a map.
However EL would be evaluating ${framework.frameworkId} as an Integer object.
Integer != String so any lookups on the map fail. ie the number 1 is not equal to the string "1".
Solution: get the types in EL and the Map to match, and it should work.
Try this in your
java code constructing the data structures.
And then the JSTL code that I had in my previous post.
By putting an Integer as the map key the variable types should match (fingers crossed) and the JSTL code should work straight off.
--------------------------
As an alternative solution, instead of making the Map keys Integers, we could try and make the JSTL variable a String:
So leave your Java code as is (with Strings in the Map) and put the following on the JSP:
The <c:set> using the body of the tag to evaluate will result in a String.
Since String == String the map lookup should work this way as well.
Hope I haven't confused you too much ;-)
Cheers,
evnafets