你这种方式只能用在本地!客户端是无法使用的,因为他会找客户机F:/web/src/jspSmartUpload.zip的文件,当然会找不到,要用服务器路径!即http://,或相对于当前页面的路径,前提是你指定的路径有此文件,就可以访问!

解决方案 »

  1.   

    我用了相对路径后,仍然无法下载,还是显示无法打开该站点。Help me!
      

  2.   

    <p><a href="jspSmartUpload.zip">dsfdasfaf</a></p>
    就是这样写的,有什么问题啊?
      

  3.   

    绝对路径,我也试过了,还是有问题
    <p><a href="http://182.168.1.1:8001/jspSmartUpload.zip">dsfdasfaf</a></p>
    index.htm页面和下载文件jspSmartUpload.zip在同一个目录下。
      

  4.   

    ● 软件下载问题 ---------------------------------------------------------------  
    例如此文件名是getfile.jsp  
    与此文件的同目录下有一个test.doc的word目录,则用  
    http://localhost/getfile.jsp?file=test.doc   <%@page  import="java.util.*"%>  
    <%@page  import="java.io.*"%>  
    <%@page  import="java.net.*"%>  
    <%  
           String  filename  =  "";  
           if  (request.getParameter("file")  !=  null)  {  
           filename = request.getParameter("file");  
           }  
           response.setContentType("application/msword");  
           response.setHeader("Content-disposition","attachment;  filename="+filename);  
     
           BufferedInputStream  bis  =  null;  
           BufferedOutputStream  bos  =  null;  
           try  {  
           bis  =  new  BufferedInputStream(new  FileInputStream(getServletContext().getRealPath(""  +  filename)));  
           bos  =  new  BufferedOutputStream(response.getOutputStream());  
     
           byte[]  buff  =  new  byte[2048];  
           int  bytesRead;  
     
           while(-1  !=  (bytesRead = bis.read(buff,  0,  buff.length)))  {  
           bos.write(buff,0,bytesRead);  
           }  
     
           }  catch(final  IOException  e)  {  
           System.out.println  (  "&sup3;&ouml;&Iuml;&Ouml;IOException."  +  e  );  
           }  finally  {  
           if  (bis  !=  null)  
           bis.close();  
           if  (bos  !=  null)  
           bos.close();  
           }  
           //return;  
    %>