<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/>

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

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

        <li>pageContext.findAttribute(varname)
          <p>which is like getting the first of:</p>
          <ul>
          <li>page.getAttribute(varname)
          <li>request.getAttribute(varname)
          <li>session.getAttribute(varname)
          <li>application.getAttribute(varname)
          </ul>
      </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>

    </section>
  </body>
</document>
  
