tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: Inconsistent output of Java 5 enums
Date Thu, 14 Oct 2010 21:58:17 GMT
2010/10/14 Christopher Schultz <chris@christopherschultz.net>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Oliver,
>
> On 10/14/2010 12:24 PM, Oliver Siegmar wrote:
>> On Wednesday 13 October 2010 21:21:33 Christopher Schultz wrote:
>>> What do your taglib declarations look like? I've only used the JSTL a
>>> little bit, and I found that when you have the wrong taglib URL, things
>>> don't work properly.
>>
>> This is how I use JSTL core:
>>
>> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
>
> That looks like the one that worked properly for me.
>
> I unfortunately know very little about the JSTL and it's interaction
> with POJOs. I would expect that value="${enum}" would somehow convert
> the value to a String for inclusion into the output stream, and calling
> EnumType.toString sounds like the right thing to do.
>
> Can you look at the translated .java file that comes from your sample
> .jsp and post what the JSP compiler has generated?
>
> This might be a bug, but I'm not really sure. What if the object is not
> an enum?
>

The chapter 1.18.2 of the Expression Language Specification Version
2.1, Final Release - May 8, 2006 (a part of JSR-000245: JSP 2.1)
defines how an EL expression is coerced to a String.

One of the points there is
* "Otherwise, if A is Enum, return A.name()"

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message