0

I'm trying to import a JSP using c:import and c:url, but it tells me it couldn't find the file. I tryed using a link to see if it opens the file, and it works fine. So, I suppose the path is correct, but it isnt't working.

My code is like this:

<c:url value="/cabecalho.jsp" var="cabecalho" />
<c:import value="${cabecalho}"></c:import> //page don't open
<a href="${cabecalho}">link</a> //to test the path

If I use <c:url value="cabecalho.jsp" /> it works fine!

What must be happening?

jpenna
  • 8,426
  • 5
  • 28
  • 36
  • Do you have a reference to `c:import` value attribute? It's not listed here: http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/c/import.html (maybe not your version or "c") –  Nov 16 '15 at 16:45
  • When you start the path value with a slash, it makes it relative to the server. So in that case, you must start with your web app context. Please look at BalusC answer at http://stackoverflow.com/questions/4764405/how-to-use-relative-paths-without-including-the-context-root-name and prepend ${pageContext.request.contextPath} – rickz Nov 16 '15 at 18:08

1 Answers1

0

c:url gives You absolute path from internet like http://www.somehost.com . c:import wants relative path to jsp on server.

VDanyliuk
  • 1,049
  • 8
  • 23