I did finally figure out how to get a dynamic UID. Here's what I had to do:
<c:forEach var="group" items="${categoryGroups}">
<c:set var="userId" value="${group.name}" />
<display:table name="${results[group.name]}" class="simple nocol"
defaultsort="1" uid="${totalGroup}" ...>
<c:set var="currentRow" value="<%= pageContext.getAttribute((String)
pageContext.getAttribute("userId"))%>"/>
<display:column title="Equipment Category"
property="equipmentCategoryName"/>
<c:forEach var="year" items="${currentRow.years}"
<display:column title="${year}" value="${currentRow.quantityMap[year]}"
total="true" format="{0,number,#,###}" />
</c:forEach>
</displayTable>
</c:forEach>
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!
---------------------------------
Don't be flakey. Get Yahoo! Mail for Mobile and
always stay connected to friends.
-------------------------------------------------------------------------
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
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user