This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 9344


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: 9344

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
Similar Threads
struts2:Displaying dtatbase values in jsp
Struts 2 checkboxlist error - list key could not be resolved
Radio buttons for each row in s iterator tags
Iterating over Map using JSTL
[Struts2] losing display only(prepopulated) values of the form if the validaiton fails