title: JSP EL and Scriptlets - How to Avoid mixing jstl and scriptlet vars
body: <p>Accessing non-properties via jsp el</p>
  
  <p>In the code below, I need to access a method that is not a property.  I need a c:foreach variable to be visible to be the test as well.  I'm dealing with someone else's code.  I'm not particularly happy with the design of it, but that's easy when dealing with someone else's code.</p>
  
  <p>I would prefer to just set the actual visible roles in the controller, but all of the data is read from a global cache in multiple places.  The junk below represents the fewest lines of code to get desired behavior.</p>
  
  <p>&lt;c:forEach var="role" items="${resource.value.rs}"&gt;</p>
  
  <p>//don't have access to role in scriptlet context</p>
  
  <p>&lt;c:if test="&lt;% role.isVisible(session.getAttribute("authUser")) %&gt;"&gt;</p>
  
  <p>&lt;/c:if&gt;
  &lt;/c:foreach&gt;</p>
  
  <p>A simple solution would be .. if I could do:</p>
  
  <p>//can't call isVisible through el I don't believe</p>
  
  <p>&lt;c:if test="${role.isVisible(session.authUser)}"&gt;</p>
  
  <p>but I am pretty sure you can't do that.</p>
  
  <p>I'm in the process of rewriting to avoid scriptlets, but if anyone had a quick fix, I would entertain it.</p>
  
  <p>Thanks.</p>