<c:when test="${sessionScope.userName == emp.ename}">
yep, they we're equal
</c:when>
The sessionScope isn't even necessary as JSTL will search the different scopes for the value, but the above will avoid name clashes when you have a userName attribute in two different scopes.
It can be done by using following:
<c:choose>
<c:when test="${sessionScope['userName'] eq emp.ename}">
<!-- do sothing here -->
</c:when>
<c:otherwise>
<!-- do something else -->
</c:otherwise>
</c:choose>
However, there is an alternative way to achieve more sophisticated requirement.
New JSTL 1.1 solution:
<!-- say you want to search just a portion match -->
<c:choose>
<c:when test="${fn:contains(sessionScope['userName'],emp.ename)}">
<!-- sessionScope['userName'] was partially matched -->
</c:when>
<!-- ... etc -->
</c:choose>
Refer more from the article which I wrote:
http://avatar21.superihost.com/index.php?entry=entry070124-185808
Regards,
Avatar Ng