Author
Problem iterating over implicit EL header object
Ste Graham
Greenhorn
Joined: Sep 15, 2003
Posts: 23
On my workstation which is running Tomcat 5.5 (Java 1.5 JVM) the following code works and prints out the HTTP headers:
However, when I copy it over to our server which is running Tomcat 6 (1.6 JVM) I get the following output:
Why is this? Any help/advice much appreciated!
Stephen
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56151
Either Tomcat changed the toString() method on their implementation class, or they changed the class itself.
I haven't tried it myself, but you should be able to retrieve the key and value properties of the entry (rather than relying upon the toString() of the entry itself).
[Smart Questions ] [JSP FAQ ] [Books by Bear ] [Bear's FrontMan ] [About Bear ]
Ste Graham
Greenhorn
Joined: Sep 15, 2003
Posts: 23
Thanks! I have now:
, and this works. For some reason I didn't know you could reference the names and values like this! ops:
Stephen
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted Jan 22, 2009 08:58:33
0
EL leans on getters/setters. ${foo.bar.waa} roughly translates to "foo.getBar().getWaa()".
java.util.Map.Entry has getKey() and getValue() methods.
[Edit: not-so-nice portion removed]
Code depot of a Java EE / JSF developer | JSF / Eclipse / Tomcat kickoff tutorial | DAO kickoff tutorial | I ♥ Unicode
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56151
What may not have been obvious is that the iteration elements implement Map.Entry.
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted Jan 22, 2009 09:25:26
0
${header} refers to a java.util.Map .
subject: Problem iterating over implicit EL header object