当前位置: 代码迷 >> J2EE >> 用struts2 做文件下载 不知道如何转码显示中文,求指点
  详细解决方案

用struts2 做文件下载 不知道如何转码显示中文,求指点

热度:73   发布时间:2016-04-17 22:58:15.0
用struts2 做文件下载 不知道怎么转码显示中文,求指点
这是 Action
public String execute() throws Exception {

contentType = getSchedule_contenttype();

String filename = this.getSchedule_name();
contentDisposition = "attachment;filename="+filename;
String path = this.getSchedule_src();
ServletContext servletContext = 
ServletActionContext.getServletContext();

String fileName = servletContext.getRealPath(path);
inputStream = new FileInputStream(fileName);
contentLength = inputStream.available();

return SUCCESS;
}


------解决思路----------------------
URLEncode编码一下就行了
  相关解决方案