Mapping ZK访问服务器上的资源

Mapping ZK访问服务器上的资源,mapping,download,tomcat7,zk,Mapping,Download,Tomcat7,Zk,我在Windows XP上尝试使用ZK 7和Tomcat 7开发Web应用程序时遇到问题 问题出在我写的文件下载函数上: String path = Executions.getCurrent().getDesktop().getWebApp()+"/28.txt"; try { Filedownload.save(path,null); } catch (Exception e) { Messagebox.show("Errore

我在Windows XP上尝试使用ZK 7和Tomcat 7开发Web应用程序时遇到问题

问题出在我写的文件下载函数上:

        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异常吗?如何访问该文件并将其下载

谢谢

解决方案如下:

    String percorso = "/28.txt
    try {
        Filedownload.save(percorso,null);
    } catch (Exception e) {
        Messagebox.show("Errore recupero risorsa "+percorso);
    }
但问题可能出在上传上 您应该使用以下路径进行上载: 字符串路径=执行。getCurrent().getDesktop().getWebApp().getRealPath(“/”+”文件夹/”