action 从前台页面接受到文件名,传到action里的时候中文乱码?
下载下来的文件名字乱码.打开后内容页乱码?
前台从数据查出来的:下载/s:a
后台:
private String fileName;
private Datum d;(getter,setter给了)
public InputStream getInputStream() throws Exception{
this.fileName=d.getDatumname();
System.out.println(d.getDatumname());
System.out.println(fileName);
ServletActionContext.getResponse().setHeader("Content-Disposition","attachment;fileName="+java.net.URLEncoder.encode(fileName, "utf-8"));
return ServletActionContext.getServletContext().getResourceAsStream("upload"+"//"+fileName);
}
public String execute(){
return SUCCESS;
}
}
struts.xml:
<result name="success" type="stream">
<param name="contentType">application/octet-stream;charset=iso8599-1</param>
<param name="inputName">inputStream</param>
<param name="bufferSize">4096</param>
<param name="contentDisposition">attachment;filename="${fileName}"</param>
</result>
</action>
这是哪儿出错了啊?
ssh,myeclips,tomcat7