0

I am trying to include a JSP page using directive in another JSP.

My code is:

<%@include file="${pageContext.request.contextPage}/Pages/Loader/
load-resources.jsp" %>

As you can see here clearly that my url should be like

localhost://port/WebApp1/Pages/Loader/load-resources.jsp

But on execution i am receiving this error which says this URL does not exist. But i passed url in reference from contextPage.

Caused by: org.apache.jasper.JasperException: PWC6117: File 
"/Pages/Test/Take/${pageContext.request.contextPage}/Pages/Loader/
load-resources.jsp" not found

How to resolve this issue?

Malwinder Singh
  • 6,644
  • 14
  • 65
  • 103

1 Answers1

0

Ok, if you want to include Pages/Loader/load-resources.jsp, simply use :

<%@include file="/Pages/Loader/load-resources.jsp" %>

You do not include an URL, but a file. The root of the hierarchy is simply the root of your web application.

By the way, are you aware of the differences between the directive <%@include ... %> and the tag <jsp:include .../> :

  • with the directive, you include the source file, meaning all page context variables will be shared
  • with <jsp:include .../>, you include at output level, meaning each page will have its own page context
Serge Ballesta
  • 143,923
  • 11
  • 122
  • 252