I have the following situation:
Servlet instantiated at root
/ MinhaServlet
Jsp instantiated in a folder inside the root:
/folder/file.jsp
Within this file I have the following
<img src="_img/editar.png">
<a href="_global/topoErro.jsp">Editar</a>
<jsp:include page="_global/topoErro.jsp" /> </div>
Note that both the image and the href link are pointing to folders that are in the root of the application but should be with ../ before this file is in / folder as well as / _img and / _global.
My question is why does jsp include give error when using the same way as href if the files that are in href and the file that is in jsp include are the same?
_global,
_img
They are folders that are in the root! And my Servlet is also annotated in root
@WebServlet(
name="MinhaServlet",
urlPatterns={"/MinhaServlet"}
)
No web.xml message
In my project it looks like this: Here I am having trouble sticking. erro404.jsp
<jsp:useBean id="constantes" class="util.Constantes" />
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="_global/_css/estiloSite.css" />
<title>${constantes.tituloSite}</title>
</head>
<body class="fadeIn">
<div id="topo"> <jsp:include page="../_global/topoErro.jsp" /> </div>
<div id="meio"> <jsp:include page="erro404Conteudo.jsp" /> </div>
<div id="mapa"> <jsp:include page="../_global/mapaErro.jsp" /> </div>
<div id="creditos"> <jsp:include page="../_global/creditosErro.jsp" /> </div>
</body>
</html>
error404Content
<div id="central">
Esta página não existe! <br/>
Código do Erro : ${statusCode} <br/>
<img src="_img/editar.png">
<a href="_global/topoErro.jsp">Editar</a>
<jsp:include page="_global/topoErro.jsp" />
</div>