I try to create a table that includes a
unit in the first column. In the second column I want to create a drow down list with managers, and the manager for the specific unit should be selected. Everything works fine except for the selection of the correct manager.
Here is my code:
<table width="500" cellspacing="0" cellpadding="0" border="1">
<tr>
<td> <b>Unit</b></td>
<td>nbsp;<b>Manager</b></td>
</tr>
<c:forEach items="${UnitList}" var="unitrow">
<c:set var="unitManagerField" value="${UnitManager${unitrow.unitId}
}"/>
<tr>
<td class="inputcell">
<c:out value="${unitrow.UnitName}" />
</td>
<td>
<select>
<c:forEach items="${managerList}" var="manrow">
<option value='<c:out value="${manrow.userId}" />'
//Test wanted
>
<c:out value="${manrow.userName}" />
</option>
</c:forEach>
</select>
</td>
</tr>
</c:forEach>
</table>
In the "Test wanted" part above, I want to check if manrow.userId is equals to the value that is stored in the request attribute that has the same name as the
string stored in variable unitManagerField. But when I have set the variable unitManagerField above, then the value "UnitManager10" for example, is stored as a string. And when I put the variable in <c:out value="${unitManagerField}" /> I just get the string, not the value from the field.
I do not know how to solve this. Please help.