title: Cannot access variable inside the included JSP
body: <p>I am using Spring 2.5 in my application. In the view I have main jsp in which I have included another jsp. I have declared a variable using c:set tag in main jsp which I can not access inside the jsp. Below is code
  main.jsp</p>
  
  <pre><code>&lt;c:set var="hPediquestStudy"&gt;&lt;spring:message code="study.hpediquest.mapping" /&gt;&lt;/c:set&gt;
  &lt;c:set var="currentStudy" value='&lt;%=(String)session.getAttribute("currentStudy")%&gt;'/&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;c:if test="${currentStudy eq hPediquestStudy}"&gt;
    Variables are equal
  &lt;/c:if&gt;
  &lt;c:if test="${currentStudy ne hPediquestStudy}"&gt;
    Variables are not equal
  &lt;/c:if&gt;
  &lt;jsp:include page="/WEB-INF/jsp/included.jsp"&gt;&lt;/jsp:include&gt;
  &lt;/body
  &lt;/html&gt;
  </code></pre>
  
  <p>included.jsp</p>
  
  <pre><code>&lt;c:if test="${currentStudy eq hPediquestStudy}"&gt;
     hPediquestStudy Variable is accessible
  &lt;/c:if&gt;
   &lt;br/&gt;currentStudy : ${currentStudy}
   &lt;br/&gt;hPediquestStudy : ${hPediquestStudy}
  </code></pre>
  
  <p>I am getting output</p>
  
  <p>Variables are equal</p>
  
  <p>currentStudy : hPediquest</p>
  
  <p>hPediquestStudy : </p>
  
  <ol>
  <li>Why on main jsp both values are equal while in included jsp I dont see its value?</li>
  <li>Why currentStudy displays its value inside the included jsp?</li>
  <li>is there any solution which helps me to access the variable set in the parent jsp ans can be accessed in the included jsps?</li>
  </ol>
  
  <p>I can see the value of hPediquestStudy value if I set that variable in included jsp like in main jsp. But I dont want to set it every time when I include the jsp. Please help</p>