文件下载Can not find a java.io.InputStream with the name [inputStream] in the invocation stack错误
2016-09-26 15:33
309 查看
转自:http://blog.csdn.net/sapphire_aling/article/details/6715448
今天实现文件下载功能,照着网上的代码写了,结果总是提示下面的错误:
Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <param name="inputName"> tag specified for this
action.
这个错误,这个错误网上的解释都是正确的,就是输入流得到的是空
网上的得到输入流都是用这句话实现: 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. Check the <param name="inputName"> tag specified for this
action.
这个错误,这个错误网上的解释都是正确的,就是输入流得到的是空
网上的得到输入流都是用这句话实现: inputStream=ServletActionContext.getServletContext().getResourceAsStream(realPath);
这里正常解释是相对路径realPath要以/开头,而且要下载的文件要位于Webcontent目录下
不过在我这里就是行不通
因此我放弃了相对路径,改成绝度路径实现
String realPath = "d:\\Aggressive\\" + uploadFileName;
File file = new File(realPath);
inputStream = new FileInputStream(file);
这样就可以了
希望对有同样问题的朋友能有个帮助
相关文章推荐
- SSH 文件下载发生异常: Can not find a java.io.InputStream with the name [inputStream] in the invocation sta
- struts2文件下载出现Can not find a java.io.InputStream with the name [imageStream] in the invocation stack.
- 通过Struts2文件下载时Can not find a java.io.InputStream with the name 异常
- (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错误
- struts2文件的下载,Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the tag specified
- 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下载文件错误信息java.lang.IllegalArgumentException: 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 [targetFile] in the invocation
- 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 [inputStream] in the invocation
- struts2文件下载出现Can not find a java.io.InputStream with the name的错误