title: jsp choose statement
body: <p>I have a header.jsp that I want to include in multiple pages. The header page has three links in it. I am using css to indicate to the user which page they are on at any given point. Here is the code for header.html:</p>
  
  <pre><code>&lt;ul&gt;
      &lt;%-- Check for the activeState parameter to decide which css to use --%&gt;
      &lt;c:choose&gt;
          &lt;c:when test='${requestScope.activeState == "home"}'&gt;
              &lt;li&gt;&lt;a href="index.jsp" class="active"&gt;&lt;span&gt;Home&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;/c:when&gt;
          &lt;c:otherwise&gt;
              &lt;li&gt;&lt;a href="index.jsp"&gt;&lt;span&gt;Home&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;/c:otherwise&gt;
      &lt;/c:choose&gt;
  
      &lt;c:choose&gt;
          &lt;c:when test='${requestScope.activeState == "about"}'&gt;
              &lt;li&gt;&lt;a href="about.jsp" class="active"&gt;&lt;span&gt;About Us&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;/c:when&gt;
          &lt;c:otherwise&gt;
              &lt;li&gt;&lt;a href="about.jsp"&gt;&lt;span&gt;About Us&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;/c:otherwise&gt;
      &lt;/c:choose&gt;
  
      &lt;c:choose&gt;
          &lt;c:when test='${requestScope.activeState == "contact"}'&gt;
              &lt;li&gt;&lt;a href="contact.jsp" class="active"&gt;&lt;span&gt;Contact Us&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;/c:when&gt;
          &lt;c:otherwise&gt;
              &lt;li&gt;&lt;a href="contact.jsp"&gt;&lt;span&gt;Contact Us&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;/c:otherwise&gt;
      &lt;/c:choose&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>This is what the index.jsp file calls:</p>
  
  <pre><code>&lt;jsp:include page="header.jsp"&gt;
      &lt;jsp:param value="home" name="activeState"/&gt;
  &lt;/jsp:include&gt;
  </code></pre>
  
  <p>This does not work. Six links are showed in the index.html page. Three with css and three without css. Here is what the source looks like for the index.html page:</p>
  
  <pre><code>&lt;c:choose&gt;
      &lt;c:when test='false'&gt;
          &lt;li&gt;&lt;a href="index.jsp" class="active"&gt;&lt;span&gt;Home&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;/c:when&gt;
      &lt;c:otherwise&gt;
          &lt;li&gt;&lt;a href="index.jsp"&gt;&lt;span&gt;Home&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;/c:otherwise&gt;
  &lt;/c:choose&gt;
  
  &lt;c:choose&gt;
      &lt;c:when test='false'&gt;
          &lt;li&gt;&lt;a href="about.jsp" class="active"&gt;&lt;span&gt;About Us&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;/c:when&gt;
      &lt;c:otherwise&gt;
          &lt;li&gt;&lt;a href="about.jsp"&gt;&lt;span&gt;About Us&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;/c:otherwise&gt;
  &lt;/c:choose&gt;
  
  &lt;c:choose&gt;
      &lt;c:when test='false'&gt;
          &lt;li&gt;&lt;a href="contact.jsp" class="active"&gt;&lt;span&gt;Contact Us&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;/c:when&gt;
      &lt;c:otherwise&gt;
          &lt;li&gt;&lt;a href="contact.jsp"&gt;&lt;span&gt;Contact Us&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;/c:otherwise&gt;
  &lt;/c:choose&gt;
  </code></pre>
  
  <p>I also tried to get the activeState parameter using the <code>param.activeState</code> instead of <code>requestScope.activeState</code>. No change in behavior. Can somebody explain what is going on?</p>