I have a HashMap (hshFields) of HashMaps (ecd_date, owned_by, etc..) with keys (label, size, etc..that I access as such:
<c:out value="${hshFields.ecd_date.label}" />
<c:out value="${hshFields.owned_by.label}" />
<c:out value="${hshFields.fnd_source.label}" />
(note: I must use JSTL and not EL)
the about spits out the a "label" of the field (maintained in an XML map) i.e.:
commitment_id = Commitment Id
owned_by = Commitement Owner
fndsource = Funding Source
I'd like to now use a jstl forToken to loop over the nested HashMap. But I can not get it to work. Here is one of my attempts:
<c:forTokens items="commitment_id, owned_by, fndsource" delims="," var="curField">
The Field Label is: <c:out value="${hshFields.${curField}.label}" /> <br />
The Field Sixze is: <c:out value="${hshFields.${curField}.size}" /> <br />
</c:forTokens>
Is this not working because Of incorrect syntax or hopefully not because I don't have EL capability??
EDIT OK based on skaffman's response below I have:
<c:forTokens items="owned_by, ecd_date, commitment_id" delims="," var="curField">
Label for <c:out value="${curField}" /> : <c:out value="${hshFields[curField].label}" /><br></br>
</c:forTokens>
and the output is:
Label for owned_by : Commitment Owner
Label for ecd_date :
Label for commitment_id :
It seems to be working only on the first token because if I use the following:
Label for owned_by : <c:out value="${hshFields.owned_by.label}" /> <br></br>
Label for ecd_date : <c:out value="${hshFields.ecd_date.label}" /> <br></br>
Label for commitment_id : <c:out value="${hshFields.commitment_id.label}" /> <br></br>
I get this output:
Label for owned_by : Commitment Owner
Label for ecd_date : Estimated Completion Date
Label for commitment_id : Commitment Number