• Post Reply Bookmark Topic Watch Topic
  • New Topic

iterating through a Map

 
Terry Huang
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a javabean called MyFile that has getter and setter methods for: fileName, filePath...

I store the javabeans in a TreeMap (which is stored in another Map called Database, but thats not relevant)

in my jsp..:



I get an error :




but if I do this:




I get the correct infomation..
(822582126_l.jpg is the key in the TreeMap for the MyFile bean)


anyone know why? and how I can fix this?
[ July 04, 2007: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65520
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you iterate through a Map. the items will be instances of Map.Entry. Perhaps it is the value property of these items that you are after?
 
Terry Huang
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well the value of the Map is a javabean called MyFile and I want to access its properties
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65520
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My point is that the entry in the map will be available as the value property of the iteration item.

So I suspect (can't be sure wih the data available) that your code needs to be:


[ July 04, 2007: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!