title: EL ExpressionFactory, scopes, JSTL forEach tag, iterated variable: where is?
body: <p>I am working with ExpressionFactory inside my program, and I wan to make ValueExpressions and variables be accessible from JSP with EL expressions.</p>
  
  <p>I can't understand something: looks like my variables I put way override normal variables, for example, those set by forEach tag when iterating. I am thinking that my code puts user in a pageScope, and obvoiusly so does forEach tag, but I am wrong.</p>
  
  <p>How should I work with factory and value expressions, so that I can access variables unless they are overridden, not vice versa like in the following example?:</p>
  
  <pre><code>&lt;%@page import="javax.el.ValueExpression"%&gt;
  &lt;%@page import="javax.el.ELContext"%&gt;
  &lt;%@page import="javax.el.ExpressionFactory"%&gt;
  &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt;
  &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd"&gt;
  
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;Check Scopes&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;%
        ExpressionFactory ef = JspFactory.getDefaultFactory().
                getJspApplicationContext(application).getExpressionFactory();
        ELContext ec = pageContext.getELContext();
        ValueExpression ve = ef.createValueExpression(ec, "humangus", String.class);
        pageContext.getELContext().getVariableMapper().setVariable("user", ve);
        String[]users = new String[]{"mike", "bob", "kate"};
        pageContext.setAttribute("users", users);
        %&gt;
  
      &lt;h3&gt;List of Users:&lt;/h3&gt;
      &lt;c:forEach var="user" items="${users}" varStatus="status"&gt;
        ${status.count}: 
  without specifying scope: ${user}, 
  from page scope: ${pageScope.user}&lt;br/&gt;
      &lt;/c:forEach&gt;
  
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This produces the following:</p>
  
  <p><strong>List of Users:</strong></p>
  
  <p>1: without specifying scope: humangus, from page scope: mike</p>
  
  <p>2: without specifying scope: humangus, from page scope: bob</p>
  
  <p>3: without specifying scope: humangus, from page scope: kate</p>