您的位置:首页 > 其它

一个项目中调用另外一个项目中下载文件的servlet来下载本项目中的资源

2009-05-11 16:06 369 查看
int s = context.getRealPath("/").lastIndexOf("web_upload");
String downloadpath = context.getRealPath("/").substring(0, s)
+"ptop"+File.separator+"xiazai" + File.separator;
System.out.println(downloadpath);

或者

int s = context.getRealPath("").lastIndexOf("//");//获取上一级目录
String downloadpath = context.getRealPath("").substring(0, s)+File.separator
+"ptop"+File.separator+"xiazai" + File.separator;

下载
<a href="../web_upload/servlet/down?downFile=2.rar">下载</a>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐