<C: import> tag

I'm trying to import a file from Header.jsp into my file using the url attribute to import tags, but I get a runtime error - java.io.FileNotFoundException: http: // localhost: 8081 / latest / header.jsp

The imported file and the importing file in the same web application (last).

Import File Code:

<%@ 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 the imported file:

 <em><strong>${param.name}</strong></em><br> 
+4
source share
2 answers

If they are in the same webapp, you don’t need a full URL, you just need a URI relative to the webapp root:

 <c:import url="/header.jsp" charEncoding="UTF-8" /> 
+9
source

Perhaps you are using the wrong path where the header.jsp file is located? is it in a directory called "last"? or is the "last" context of your application?

skaffman is right, you do not need the full URL, but only the URL relative to the root of the web application.

0
source

All Articles