Ann and Mike Mastrota wrote:
> I gave a bit of a bad example. Here's what I was trying to do.
>
> I have an List of Strings - "categoryGroups" that I want to iterate over:
> c:forEach var="group" items="${categoryGroups}"
> <display:table name="testList" sort="external"
> defaultsort="1" uid="${group}">
>
> I want to name my UID "group"
>
> let's say group="helicopter"
>
> I then need to access attributes of that object in display tag:
>
> <c:forEach var="year" items="${${categoryGroups}.years}"
> <display:column title="Equipment Name" >
> ${${group}.quantityMap[year]}
> </displayColumn>
> </c:forEach>
> ${group.quantityMap[year]} will not work since group is a string that
> does not have an attribute called quantityMap.
>
> I really need ${helicoptor.quantityMap[year]} but I don't know how to
> format that string since I can't use ${{group}.quantityMap[year].
>
Ah right I see what you're doing now. The variable "group" holds the
name of another variable that you actually want to use.
Can you put the helicopter (and other similar objects) into a Map? Then
you could use the Strings in the categoryGroups List as keys:
${MyObjects(group).quantityMap[year]}
(the syntax is probably incorrect but I expect you get the idea).
I don't think there is a way of double de-referencing a variable (I
remember you could do it in Foxbase). I usually find that if there isn't
a way to do something I want it's because I'm not doing it the easiest way.
Ed!
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
displaytag-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-user