In the following EL, lookup is a Map that has Strings as keys. The expression will use form.code to look up the the corresponding description.
${lookup[form.code].longDescription}
This works fine if form.code is a
String. However, in some instances, form.code will be a primitive long or int, in which case the lookup will fail because there is no type-coercion with map keys. Is there a way, aside from changing the Map key type, to get the lookup to work with a primitive int or long value? I've experimented with c:set but this only changed form.code from primitive long to java.lang.Long.
<c:set var="code" value="${'' + form.code}" />
didn't work for me either: the code variable will still be a java.lang.Long.
TIA