Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<c:import> tag

Tags:

java

url

jsp

jstl

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>
like image 629
Greenhorn Avatar asked Dec 30 '22 20:12

Greenhorn


1 Answers

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" />  
like image 73
skaffman Avatar answered Jan 05 '23 01:01

skaffman