浏览 2968 次
锁定老帖子 主题:ssh下载问题,下面是代码
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2015-08-27
action:public class DownAction extends ActionSupport{ /** * */ private static final long serialVersionUID = 1L; private String path=ServletActionContext.getServletContext().getRealPath("upload")+"\\"; private String fileName; public String getFileName() throws UnsupportedEncodingException { return new String(fileName.getBytes(), "ISO-8859-1"); } public void setFileName(String fileName) { this.fileName = fileName; } public InputStream getInputStream() throws FileNotFoundException{ return new FileInputStream(new File(path, fileName)); } public String execute(){ return "success"; } } struts.xml <action name="down" class="com.news_date.control.DownAction"> <result name="success" type="stream"> <param name="inputName">inputStream</param> <param name="contentDispostion">attachment;filename="${fileName}"</param> </result> </action> 执行报错: Struts has detected an unhandled exception: Messages: Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the tag specified for this action. File: org/apache/struts2/dispatcher/StreamResult.java Line number: 237 这是啥问题啊,求指教.新手不容易啊.总是受伤害啊 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |