
Originally Posted by
gacheng
Any tag library guru can help me on this issue?
In JSP:
<c:forEach items="${command.injuries}" var="oneItem" varStatus="status">
<form:select id="injuries[${status.index}].level1code" cssClass="injClass1"
path="injuries[${status.index}].level1Code">
<form:options items="${xyzList_status.index}" itemLabel="description" itemValue="code" />
</form:select>
</c:forEach>
In refrenceData() in java side, I have pre-defined:
int ind = 0;
for (injury : Injuries) {
dataMap.put("xyzList_"+ind, getList4xyz(ind));
ind++;
}
As yout can see, the "items" variable in form:options has to be dynamic and depending on the index value of outer forEach loop and all those "items" values are pre-set in referenceDate() method. However, the "status_index" was not replaced with a numeric value to be used to retrieve the list from dataMap. If I used "xyzList_0" or "xyzList_1", then it works. In another word, the variable for items in form:options has to be hard-coded.
Any workaround to solve this problem? Your suggest is really appreciated.