Issue
How do I include a file into my jsp file from the resources path? What should the path be specifically. Using either @include
or jsp:include
.
My directory structure:
I want to include resources/static/template/index.html
what should be the include path in home.jsp
.
Solution
You shouldn't have .jsp files in any subdirectory of WEB-INF
, and if webapp
is the context root of your web application, there's no way you can include anything outside it, since both the include directive and standard tag only work on files under the context root.
If you were to move the whole resources
directory under webapp
, then you'll be able to use one of the following:
<%@include file="/resources/static/template/index.html"%>
Or
<jsp:include page="/resources/static/template/index.html"/>
Answered By - Emanuele Giona
Answer Checked By - Marilyn (JavaFixing Volunteer)