File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts 2 iterate over a Map Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 iterate over a Map" Watch "Struts 2 iterate over a Map" New topic

Struts 2 iterate over a Map

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10033


I'm trying to iterate over a Map that contains an Object as a Key and has a List of other Objects as value.

For example., Map < MyObject, List < OtherObject> > myMap.

I need to iterate over myMap and display a couple of variables from the key and the remaining couple from the value. In essence I need to do something like

myMap.MyObject.firstName and myMap.MyObject.lastName and get the other values from the value as myMap.OtherObject.address1.street and so on....

I have a simple iterator as below:

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10033

Ok, I got it to work. This is what I did:

Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Why you are storing heavy object in session, why you are not using applicationAware interceptor for this purpose.

ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
I agree. Here's the link:
subject: Struts 2 iterate over a Map
It's not a secret anymore!