JSP include问题
我想请教一个include file的问题。
目录结构
-abc
-index.jsp
-include
-head.jsp
index.jsp页面:<%@include file="../include/head.jsp" %>
想引用上级目录下一个文件夹里的文件。
但是报错500:
org.apache.jasper.JasperException: /index.jsp (line: 19, column: 1) File "/../include/head.jsp" not found
好像跳不出当前目录
------解决方案--------------------<%@include file="/include/head.jsp" %>
------解决方案--------------------
个人感觉jsp include指令不好用,可以使用jsp include动作,可以看一下这个:
http://www.cnblogs.com/azai/archive/2009/11/12/1601533.html
------解决方案--------------------<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>