Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can you Compare bean values in <c:ForEach> and <c:when>

Status
Not open for further replies.

FreshmenProgrammer

Programmer
Jan 16, 2006
42
CA
First I would like to say thanks in advance for whoever is helping. I really appreciate it.

I'm just wondering if you can compare the dept with a session scope bean variable. I know you can campare eg.${dept == 'accounting'} but I was wondering if you can campare the dept in the forEach loop with a Bean variable. Is that possible and how would you write it. Thank you!!.

Code:
<c:forEach var="dept" items="${sessionScope.dBean.dept}">

<c:choose>                  
<c:when test="${dept == sessionScope.Temp.dept}">
   <option selected><c:out value="${dept}"/></option>
</c:when>
<c:otherwise>
   <option><c:out value="${dept}"/></option>
</c:otherwise>

</c:choose>
</c:forEach>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top