<document>
  <header>
    <product>resin</product>
    <title>JSP EL</title>
    <version>Resin 3.0</version>
    <description>
      <p>JSP EL is a simple expression language for accessing
      data.</p>
    </description>
  </header>

  <body>
    <summary/>

    <s1 title="JSP EL variables">
      <p>EL Variables come from one of two places:</p>

      <ol>
        <li>implicit variable
          <deftable>
          <tr><td>pageContext
              </td><td>
          </td></tr><tr><td>pageScope
              </td><td>
          </td></tr><tr><td>requestScope
              </td><td>
          </td></tr><tr><td>sessionScope
              </td><td>
          </td></tr><tr><td>applicationScope
              </td><td>
          </td></tr><tr><td>param
              </td><td>
          </td></tr><tr><td>paramValues
              </td><td>
          </td></tr><tr><td>header
              </td><td>
          </td></tr><tr><td>headerValues
              </td><td>
          </td></tr><tr><td>cookie
              </td><td>
          </td></tr><tr><td>initParam
              </td><td>
          </td></tr></deftable>

        </li><li>pageContext.findAttribute(varname)<br/>
          which is like getting the first of:
          <ul>
          <li>page.getAttribute(varname)
          </li><li>request.getAttribute(varname)
          </li><li>session.getAttribute(varname)
          </li><li>application.getAttribute(varname)
          </li></ul>
      </li></ol>

      <p>So if you have a variable like:</p>

      <example>
&lt;% boolean a = true; %&gt;
      </example>

      <p>you have to store it as an attribute to make it available as an EL
        variable:</p>

      <example>
&lt;% 
  boolean b = true; 
  pageContext.setAttribute("b",new Boolean(b));
%&gt;

&lt;c:if test="${b}"&gt;
b is TRUE
&lt;/c:if&gt;

      </example>

      <p>Here is an example that shows this a bit more:</p>

      <example title="Making values available as JSP EL variables">
&lt;%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %&gt;
 
&lt;% 
  boolean a = true; 

  boolean b = true; 
  pageContext.setAttribute("b",new Boolean(b));

  boolean c = false; 
  pageContext.setAttribute("c",new Boolean(c));

  boolean param = true;
  pageContext.setAttribute("param",new Boolean(param));
%&gt;
 
&lt;%-- 
  this is false because 'a' is not findable by
  pageContext.findAttribute(varname)
--%&gt;
&lt;c:if test="${'${'}a}"&gt;
a is TRUE
&lt;/c:if&gt;

&lt;c:if test="${'${'}b}"&gt;
b is TRUE
&lt;/c:if&gt;

&lt;%-- this is false because 'c' was set to false --%&gt;
&lt;c:if test="${'${'}c}"&gt;
c is TRUE
&lt;/c:if&gt;


&lt;%-- 
  This is false because 'param' is an implicit variable
  which is used instead of pageContext.findAttribute("param")
--%&gt;
&lt;c:if test="${'${'}param}"&gt;
param is TRUE
&lt;/c:if&gt;
      </example>

      <results>
b is TRUE
      </results>

    </s1>
  </body>
</document>
