Access map value in EL using a variable as key

前端 未结 5 970
野性不改
野性不改 2020-12-14 03:08

I have a Map in EL as ${map} and I am trying to get the value of it using a key which is by itself also an EL variable ${key} with the

5条回答
  •  情深已故
    2020-12-14 03:39

    I have faced this issue before. This typically happens when the key is not a String. The fix is to cast the key to a String before using the key to get a value from the map

    Something like this:

    ${someKeyThatIsNotString}

    Hope that helps

提交回复
热议问题