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].
Thanks for any help,
- Ann
Ann and Mike Mastrota wrote:
> I want to dynamically build display tables using c:forEach in JSTL.
> This works for the most part, however, if I want to use the UID
> object within the display table, I then have a problem since I do not
> know how to then get to the object values using a valid JSP
> expressions. Here is my JSTL/JSP code for my display table:
>
> <c:forEach var="group" items="${categoryGroups}"
> <display:table name="testList" sort="external" defaultsort="1"
> uid="${group}">
> <display:column property="equipmentName" title="Equipment Name" />
> <c:forEach var="year" items="${${categoryGroups}.years}"
> <display:column title="Equipment Name" >
> ${${categoryGroups}.quantityMap[year]}
> </displayColumn>
> </c:forEach>
> </display:table>
> </c:forEach>
>
> I know the format of ${${categoryGroups}.years} is wrong, however, I
> need to do something like this to be able to dynamically name the UID
> and get to the associated attributes of the object in order to
> retrieve a List of quantities by year. Is their syntax or a work
> around to allow what I want to do?
Have you tried ${group.years} and ${group.quantityMap[year]} ?
Ed!
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------------------------------------------------------------------
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