title: Include another JSP file
body: <p>I am currently trying to learn JSP. My question is, at present I used to include the header and footer of the page using:</p>
  
  <pre><code>&lt;%@include file="includes/header.jsp" %&gt;
  </code></pre>
  
  <p>and </p>
  
  <pre><code>&lt;%@include file="includes/footer.jsp" %&gt;
  </code></pre>
  
  <p>But now, I have separated the page content also. So, if user clicks on a page, say products, it has to load the JSP file which is situated in: <code>includes/pages/products.jsp</code>
  So, the link to the user is like: <code>&lt;a href="index.jsp?p=products"&gt;Products&lt;/a&gt;</code>.</p>
  
  <p>So, I have to get the p value and display the page based on it.</p>
  
  <p>Following is what I have done so far.</p>
  
  <pre><code>&lt;%
   if(request.getParameter("p")!=null)
   { 
     String p = request.getParameter("p");
  %&gt;    
  
  &lt;%@include file="includes/page_name.jsp" %&gt;
  
  &lt;% 
   }
  %&gt;
  </code></pre>
  
  <p>So, how do I place the value of variable "p" in position of "page_name" ?</p>
  
  <p>Or, is there any other method that I could use ?</p>
  
  <p>In PHP, we could use the <code>include()</code> or <code>include_once()</code>. I am bit stuck in this JSP. :(</p>