-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 All,
On 10/14/2010 3:24 PM, Christopher Schultz wrote: > Pid, > > On 10/14/2010 3:21 PM, Pid wrote: >> On 14/10/2010 20:03, Oliver Siegmar wrote: >>> Hi Pid, >>> >>> Am Thursday 14 October 2010 schrieb Pid: >>>> Which JSTL implementation are you using and which Java version was it >>>> compiled for/on? >>> >>> http://repo2.maven.org/maven2/javax/servlet/jstl/1.2/jstl-1.2.jar >>> >>> Using Sun/Oracle Java 6u21 > >> OK. > >> The related sources jar was built in 2006, and the pom for that >> indicates that it's dependent on JSP 2.0, rather than 2.1. > >> At a guess, JSTL doesn't know what an enum is, so it's just doing what >> it would do for any other unknown Object subclass, and is calling the >> .toString() method. > > Something I didn't bother asking: what does the default Enum.toString > return? Answer to my own question: public class EnumTest { public enum Weekday { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } public static void main(String[] args) { System.out.println(Weekday.SUNDAY); } } This produces "SUNDAY" as output. The EnumTest.Weekday "class" doesn't override the toString method, allowing java.lang.Enum (it's superclass) to handle that. java.lang.Enum.toString is implemented like this: public String toString() { return name; } ... and "name" is a String which is initialized in the constructor (when I decompile EnumTest.Weekday, I can see it uses the string "Sunday", as one might expect). So I'm surprised that Oliver is getting that weird output. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAky3Wn4ACgkQ9CaO5/Lv0PB1yACeKEbeavY+ois6H2BMndqRLWsm CxEAn0SsiuLsvv6O/Szd3QKsPZ66Mxgj =bQGI -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org