How to convert an arbitrary object to String with JSTL? (calling toString())

Posted by hstoerr on Stack Overflow See other posts from Stack Overflow or by hstoerr
Published on 2010-05-21T16:20:14Z Indexed on 2010/05/21 16:40 UTC
Read the original article Hit count: 332

Filed under:
|
|

Is there any way to call toString() on an object with the 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 JSTL 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?)

© Stack Overflow or respective owner

Related posts about jstl

Related posts about java