Is there any way to call toString() on an object with the EL and JSTL? (I need the String representation of an enum as index in a map in a JSP EL expression.) I hoped something like ${''+object}
would work like in java, but EL isn't that nice, and there does not seem to be any function that does it.
Clarification: I have a variable somemap
that maps Strings to Strings, and I have a variable someenum
that is an enumeration. I'd like to do something like ${somemap[someenum.toString()]}
. (Of course .toString() does not work, but what does?)
${}
things are not JSTL. It is Expression Language (EL). JSTL is the standard taglib, e.g.c:out
,c:forEach
, etc. – Crural${'' + object}
is not valid, but you can use${''}${object}
– Morelock