<p>I saw some code like the following in a JSP</p>

<pre><code>&lt;c:if test="&lt;%=request.isUserInRole(RoleEnum.USER.getCode())%&gt;"&gt;
    &lt;li&gt;user&lt;/li&gt;
&lt;/c:if&gt;
</code></pre>

<p>My confusion is over the "=" that appears in the value of the <code>test</code> attribute. My understanding was that anything included within <code>&lt;%= %&gt;</code> is printed to the output, but surely the value assigned to test must be a Boolean, so why does this work?</p>

<p>For bonus points, is there any way to change the attribute value above such that it does not use scriptlet code? Presumably, that means using EL instead.</p>

<p>Cheers,
Don</p>

Attributes in JSP tag libraries in general can be either static or resolved at request time.  If they are resolved at request time the JSP will resolve their value at runtime and pass the output on to the tag.  This means you can put pretty much any JSP code into the attribute and the tag will behave accordingly to what output that produces.
If you look at the jstl taglib docs you can see which attributes are reuest time and which are not.
http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html