wood burning stoves 2.0*
The moose likes JSP and the fly likes Want to use a jstl value in another expression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Want to use a jstl value in another expression" Watch "Want to use a jstl value in another expression" New topic

Want to use a jstl value in another expression

Annika Noaksson

Joined: Oct 24, 2008
Posts: 1
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">
<td> <b>Unit</b></td>
<c:forEach items="${UnitList}" var="unitrow">
<c:set var="unitManagerField" value="${UnitManager${unitrow.unitId}
<td class="inputcell">
<cut value="${unitrow.UnitName}" />
<c:forEach items="${managerList}" var="manrow">
<option value='<cut value="${manrow.userId}" />'

//Test wanted

<cut value="${manrow.userName}" />

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 <cut value="${unitManagerField}" /> I just get the string, not the value from the field.

I do not know how to solve this. Please help.
Christophe Verré

Joined: Nov 24, 2005
Posts: 14687

Apart from the fact that I difficulties to understand the meaning of the first forEach loop ;), did you try to use the c:if tag ?

[My Blog]
All roads lead to JavaRanch
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60810

Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the .

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link: http://aspose.com/file-tools
subject: Want to use a jstl value in another expression
Similar Threads
Using JSTL Data Displayed In Browser Is Getting Fixed To 24576 Bytes(24 KB)
JSP column name hyperlink help
sql:query in jsp
javascript error: object expected
jstl mapped properties