日期:2014-05-17  浏览次数:20657 次

关于jsp中 include file下的地址问题
我在jsp文件中有如下一句
<%@ include file = "../test.txt" %>
此jsp文件在webcontent下,然后我在此文件的父目录下有test.txt文件,而且在elipse下也没有说有问题,运行后:
type 
Exception report

message 
/NewFile.jsp (line: 11, column: 1) File "../test.txt" not found

description 
The server encountered an internal error that prevented it from fulfilling this request.

exception
org.apache.jasper.JasperException: /NewFile.jsp (line: 11, column: 1) File "../test.txt" not found
为什么会找不到呢?
麻烦大家帮忙解决下。。非常感谢。。
jsp include file

------解决方案--------------------
在jsp文件中引用其他的文件的话,一般用相对路径,用绝对路径会导致无法识别的问题。
楼主看看jsp文件所在的路径和要引用的文件路径,然后进行引用,具体可以问问“谷老师”相对路径的用法。