相对路径和绝对路径
在index.jsp 找 a.html
- webapp
- index.jsp
 - static
- a.html
 
 
 
<%--前台路径--%>
<%--相对路径--%>
<a href="./static/a.html">./地址</a><br>
<%--从服务器的根去找   http://localhost:8080/项目名/static/a.html--%>
<a href="项目名/static/a.html">/开头地址</a><br>
<%--相对根目录webapp, webapp/static/a.html--%>
<a href="static/a.html">没有/地址</a><br>
<%--相对项目根目录webapp--%>
<a href="${pageContext.request.contextPath}/static/a.html">${pageContext.request.contextPath}地址</a><br>
<%--后台路径--%>
<%--相对当前路径  没有/地址  有/地址--%>
<%--<jsp:forward page="static/a.html"></jsp:forward>--%>
<%--相对项目名称--%>
<%--<jsp:forward page="/static/a.html"></jsp:forward>--%>
<%--相对项目名称  ${pageContext.request.contextPath}static/a.html--%>
<jsp:forward page="${pageContext.request.contextPath}/static/a.html"></jsp:forward>
                    
                
                
            
        
浙公网安备 33010602011771号