acrion public class DownloadAction extends ActionSupport { private String fileName; public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public InputStream getInputStream() throws FileNotFoundException{ System.out.println(fileName); return new FileInputStream("D:\\qq\\"+fileName); } public String download(){ return Action.SUCCESS; } } struts.xml <action name="download" class="jsh.sturts.action.DownloadAction" method="download"> <result name="success" type="stream"> <param name="contentType">text/plain</param> <param name="inputName">inputStream</param> <param name="contentDisposition">attachment;filename="${fileName}"</param> <param name="bufferSize">1024</param> </result> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <a href="download?fileName=1232323.doc">doc</a> </body> </html> 问题出在哪里了
落子鸢