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>