title: JSP include page failing with request.getContextPath()
body: <p>I'm trying to include a jsp page in another, and since I don't want to hardcode paths I want to use the request.getContextPath() methods.
  But I just can't get it to work. I've tried various things, based on various answers here:</p>
  
  <p>First thing I did was </p>
  
  <pre><code>&lt;jsp:include  page="&lt;%=request.getContextPath()%&gt;/structure/Navbar.jsp" /&gt;
  </code></pre>
  
  <p>gives me: </p>
  
  <pre><code>HTTP Status 500 - /structure/ArtiMarziali/Aikido.jsp (line: 11, column: 24) attribute value for [page] is not properly terminated
  </code></pre>
  
  <p>So I tried: </p>
  
  <pre><code>&lt;% String aikido = request.getContextPath() + "/structure/Navbar.jsp"; %&gt;
  &lt;jsp:include  page="&lt;%= aikido %&gt;" /&gt;
  </code></pre>
  
  <p>throws an exception: </p>
  
  <pre><code>HTTP Status 500 - javax.servlet.ServletException: File [/ProgettoPW/structure/Navbar.jsp] not found
  </code></pre>
  
  <p>Then:</p>
  
  <pre><code>&lt;jsp:include  page="&lt;%= request.getContextPath() + "/structure/Navbar.jsp"  %&gt;" /&gt;
  </code></pre>
  
  <p>says I need to escape the quotes, which I can't really do</p>
  
  <p>and </p>
  
  <pre><code>&lt;jsp:include  page='&lt;%= request.getContextPath() + "/structure/Navbar.jsp"  %&gt;' /&gt;
  </code></pre>
  
  <p>gives the same error as the first one. I tried setting  the result of getContextPath to a variable and using that in the tag, but same errors as before.</p>
  
  <p>I really don't know what the problem i, I need some help, thank you.</p>
  
  <p>(Yes I know that using &lt;%= %> and other scriptlets is frowned upon nowadays, but my course was taught this way and I want to adhere to it for the project)</p>
  
  <p>Edit: This is the file structure, might be useful: </p>
  
  <p><a href="https://i.stack.imgur.com/xRnEO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xRnEO.png" alt="enter image description here"></a></p>