aspose file tools*
The moose likes JSP and the fly likes Problem iterating over implicit EL header object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem iterating over implicit EL header object" Watch "Problem iterating over implicit EL header object" New topic
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: 61001
    
  65

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).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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
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]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61001
    
  65

What may not have been obvious is that the iteration elements implement Map.Entry.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
${header} refers to a java.util.Map.
 
 
subject: Problem iterating over implicit EL header object