wood burning stoves 2.0*
The moose likes Struts and the fly likes Iterate hashmap problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Iterate hashmap problem" Watch "Iterate hashmap problem" New topic
Author

Iterate hashmap problem

david arnold
Ranch Hand

Joined: Apr 10, 2009
Posts: 133
Hi,

I tried to iterate a hashmap in a arraylist and got exceptions: javax.servlet.ServletException: No getter method for property: "listCards" of bean: "categories"



In Action:


In JSP:


I already defined "getListCards" method, why do I get such exception?

Thanks for help!
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

How are you expecting to iterate over a method which returns a single object not a collection?? The getListCards method must return the entire HashMap for it to be iterated. Also the getter method must not take any arguments. To work with a single card, you can declare another getListCard(String key) method (like the one you have currently but only without the "s" in card as its returning a single card which is just a naming convention)...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
david arnold
Ranch Hand

Joined: Apr 10, 2009
Posts: 133
I see, thank you Ankit for pointing out the problem.

Regards,
 
jQuery in Action, 2nd edition
 
subject: Iterate hashmap problem
 
Similar Threads
Iterate Hashmap through struts
Iterate over a HashMap where the value is a bean
JSTL conversion for struts 1.1 code
Multibox Not Populating as Checked!!!
logic:iterate HashMap<Object,ArrayList>