文件下载Can not find a java.io.InputStream with the name [inputStream] in the invocation stack错误
来源:互联网 发布:java windowbuilder 编辑:程序博客网 时间:2024/05/29 17:24
今天实现文件下载功能,照着网上的代码写了,结果总是提示下面的错误:
Can not find a
这个错误,这个错误网上的解释都是正确的,就是输入流得到的是空
网上的得到输入流都是用这句话实现: inputStream=ServletActionContext.getServletContext().getResourceAsStream(realPath);
这里正常解释是相对路径realPath要以/开头,而且要下载的文件要位于Webcontent目录下
不过在我这里就是行不通
因此我放弃了相对路径,改成绝度路径实现
String realPath = "d:\\Aggressive\\" + uploadFileName;
File file = new File(realPath);
inputStream = new FileInputStream(file);
这样就可以了
希望对有同样问题的朋友能有个帮助
- 文件下载Can not find a java.io.InputStream with the name [inputStream] in the invocation stack错误
- 文件下载Can not find a java.io.InputStream with the name [inputStream] in the invocation stack错误
- (Struts2文件下载)Can not find a java.io.InputStream with the name [inputStream] in the invocation stack
- (文件下载)Can not find a java.io.InputStream with the name [inputStream] in the invocation stack
- Can not find a java.io.InputStream with the name [inputStream] in the invocation stack问题解决
- Can not find a java.io.InputStream with the name [inputStream] in the invocation stack问题解决
- Can not find a java.io.InputStream with the name [inputStream] in the invocation stack
- Can not find a java.io.InputStream with the name [inputStream] in the invocation stack
- struts2文件下载出现Can not find a java.io.InputStream with the name [imageStream] in the invocation stack.
- 下载文件或图片出错,显示Can not find a java.io.InputStream with the name [inputStream] in the invocation
- SSH 文件下载发生异常: Can not find a java.io.InputStream with the name [inputStream] in the invocation sta
- 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 [] 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 [...] in the invocation stack. ...
- Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack.
- Java Reader and Writer的类结构
- VFW
- mencoder和ffmpeg分割合并视频(1)--基础命令
- Web 设计与开发者必须知道的 15 个站点 .
- C语言常用函数
- 文件下载Can not find a java.io.InputStream with the name [inputStream] in the invocation stack错误
- Windows XP系统桌面锁定的快捷键(win+L 系统设置的快捷键)
- I帧和IDR帧的区别
- 216种Web安全颜色
- windows SDK一些回顾和理解
- C#委托
- Visual Studio 设置行号的方法
- 转:CISCO三层交换机+二层交换机配置VLAN的实例
- 嵌入式专业毕业生面试n次后的求职经验分享