Reputation: 328
I'm trying to import file from the Header.jsp in my file by using import tag url attribute, but I'm getting runtime error
java.io.FileNotFoundException: http://localhost:8081/latest/header.jsp
The imported file and the importing file in the same web app(latest).
The code of the importing file is:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html><body>
<c:import url="http://localhost:8081/latest/header.jsp" charEncoding="UTF-8" />
<em>Web services Support Group.</em><br><br>
</body></html>
and the code of imported file is:
<em><strong>${param.name}</strong></em><br>
Upvotes: 4
Views: 7434
Reputation: 666
probably you are using the wrong path, where is the file header.jsp? is it in a directory called "latest"? or is "latest" the context path of your application?
skaffman is right, you don't need the full url, but just the url relative to the web app root.
Upvotes: 0
Reputation: 403481
If they're in the same webapp, you don't need a ful URL, you just need the URI relative to the webapp root:
<c:import url="/header.jsp" charEncoding="UTF-8" />
Upvotes: 10