struts返回值类型

来源:互联网 发布:网络层的功能 编辑:程序博客网 时间:2024/05/16 10:05
public InputStream getDocumentInputStrame() throws FileNotFoundException{
        String downFilePathServletActionContext.getServletContext()
        .getRealPath("/");//文件路径             
               downloadFileName=tenderfile.getFilename();//文件名称
        downloadFileName=this.getFileEcodingName(downloadFileName);//调用action的方法传入参数,对文件名称进行编码解码。
        StringBuffer sb=new StringBuffer();
        sb.append(downFilePath).append(downloadFileName);
        File file=new File(sb.toString());
        InputStream in=new FileInputStream(file);
        return in;//返回输入流
    }

public String getFileEcodingName(String downloadFileName) { 
        try {
            downloadFileName=new String(downloadFileName.getBytes(),"ISO-8859-1");
        catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }       return downloadFileName; 
        }
不是说action只能返回string或者null吗?为什么上面的代码就可以编译运行啊,求指教。
0 0