2014-02-05 96 views
0

在Windows XP上嘗試使用ZK 7,Tomcat 7開發Web應用程序時遇到問題。服務器上的ZK訪問資源

的問題是對文件下載功能我寫道:

 String path = Executions.getCurrent().getDesktop().getWebApp()+"/28.txt"; 
    try { 
     Filedownload.save(path,null); 
    } catch (Exception e) { 
     Messagebox.show("Errore recupero risorsa "+path); 
    } 

路徑:C:\的OpenXava-4.5.1 \ workspace.metadata.plugins \ org.eclipse.wst.server.core \ TMP4 \ wtpwebapps \ ProjectName \

我試圖打印路徑的內容,並把它放在Windows資源管理器,顯然我得到的文件,因爲該文件是在物理上的路徑。

問題是,我得到FileNotFoundException,就像WebServer os框架沒有/找不到它。

任何想法,因爲函數拋出FileNotFound異常?如何到達該文件並下載?

感謝

回答

0

的解決方案是這樣的:

String percorso = "/28.txt 
    try { 
     Filedownload.save(percorso,null); 
    } catch (Exception e) { 
     Messagebox.show("Errore recupero risorsa "+percorso); 
    } 

但問題可能是上傳 你shuld使用這個路徑上傳: 字符串路徑= Executions.getCurrent()getDesktop ().getWebApp()getRealPath( 「/」)+ 「的文件夾/」。

相關問題