【struts2文件下载】Can not find a java.io.InputStream with the name [downloadFile]...
来源:互联网 发布:apache开源社区 编辑:程序博客网 时间:2024/06/15 17:03
Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack问题解决
解决方法:
Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack问题解决
分类: 异常分析及解决方法 java web程序设计2012-05-06 23:00 2140人阅读 评论(0) 收藏 举报actionjavanullfile转载自:http://blog.csdn.net/zhqingyun163/article/details/5063778
具体异常是这句话:
Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack. Check the <param name="inputName"> tag specified for this action.
1.文件路径不对,根本就没有取到文件。这种情况下,可以将获得InputStream的那条语句放在system.out.println()中输出一下,若为null,那就是路径不对了,或者说得准确些就根本没有找到文件。2.在action中没有写配置文件中"<param name="inputName">"后面属性的那个get方法.当以上两种情况都正确的情况下,问题就在这里了: 当采用 return ServletActionContext.getServletContext().getResourceAsStream("...") 这种方法获得输入流的时候,要保证文件位置在 ServletContext 当中,就是说要在当前的应用上下文中,如果想要获得外部文件 譬如 D盘中的某个文件,那么就要自己创建输入流才可以,如:
Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack问题解决
转载自:http://blog.csdn.net/zhqingyun163/article/details/5063778
具体异常是这句话:
Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack. Check the <param name="inputName"> tag specified for this action.
1.文件路径不对,根本就没有取到文件。这种情况下,可以将获得InputStream的那条语句放在system.out.println()中输出一下,若为null,那就是路径不对了,或者说得准确些就根本没有找到文件。
2.在action中没有写配置文件中"<param name="inputName">"后面属性的那个get方法.
当以上两种情况都正确的情况下,问题就在这里了:
当采用 return ServletActionContext.getServletContext().getResourceAsStream("...") 这种方法获得输入流的时候,要保证文件位置在 ServletContext 当中,就是说要在当前的应用上下文中,
如果想要获得外部文件 譬如 D盘中的某个文件,那么就要自己创建输入流才可以,如:
- File file = new File("D://spring.doc");
-
- InputStream is = new FileInputStream(file);
-
- return is;
- 【struts2文件下载】Can not find a java.io.InputStream with the name [downloadFile]...
- Struts2 下载 Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack
- Struts2中下载项目路径以外的文件报错 Can not find a Java.io.InputStream with the name [downloadFile] in the invoc
- 通过Struts2文件下载时Can not find a java.io.InputStream with the name 异常
- struts2文件下载出现Can not find a java.io.InputStream with the name的错误
- struts2文件下载出现Can not find a java.io.InputStream with the name的错误
- struts2文件下载出现Can not find a java.io.InputStream with the name的错误
- struts2文件下载出现Can not find a java.io.InputStream with the name的错误
- struts2文件下载出现Can not find a java.io.InputStream with the name的错误
- struts2文件下载出现Can not find a java.io.InputStream with the name的错误
- struts2文件下载出现Can not find a java.io.InputStream with the name的错误
- struts2文件下载出现Can not find a java.io.InputStream with the name的错误
- Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack问题解决
- Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack问题解决
- Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack问题解决
- Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack问题解决
- Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack.
- java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [downloadFile]
- 排序与查找
- Java多线程的相关机制
- Ext4.0
- 写的一个数组小程序
- HDU 2046 骨牌铺方格 递推
- 【struts2文件下载】Can not find a java.io.InputStream with the name [downloadFile]...
- 最近在用ubuntu安装软件时总出现E: Package 'package ' has no installation candidate的原因分析 /etc/apt/sources.list
- HDU 1043 搜索+康托展开
- SQL Server 语句 获取时间信息
- 绝对路径和相对路径
- Hive常用参数配置详细说明
- WinRAR的压缩命令
- Tiny210 U-BOOT(三)----配置时钟频率源码分析
- JVM 、JRE 、JDK 、SDK的关系