Reputation: 20875
I want to ask a question about the JSP page. I set the project in the following structure in order to manage the project efficiently. When I am in the list folder, main.jsp, I set the header as the following
<%@ include file="universe/header.jsp" %>
When I open the main.jsp, It shows the error
cannot find the "jsp/list/universe/header.jsp"
the header.jsp and other classes cannot be read. Can anyone help me to solve the problem? thank you.
Class structure
webapp
|
|-- jsp
|
|-- list
| |
| |--main.jsp
|
|-- universe
|
|-- header.jsp
|-- footer.jsp
Upvotes: 2
Views: 5110
Reputation: 10373
In a JSP include directive the path can be relative to the including page or absolute (then it has to start with a /
and belongs to the webapplication root directory).
So in this case you have to set the path either to ../universe/header.jsp
or /jsp/universe/header.jsp
.
Upvotes: 5
Reputation: 1
In JSP include directive, path can be relative.
You can use it this way
<%@ include file="/jsp/universe/header.jsp" %>
You can refer the directives on many sites. Best one is sun java website.
Or you can visit this page Include Directive
Upvotes: 0
Reputation: 18108
It depends if your using the classpath to locate files. if your using classpath to locate your files then it should be inside your class folder
Upvotes: -1