struts2的xml配置下载文件时文件名乱码

图片说明
图片说明
这里写上中文名乱码了,我可以咋解决呢?谢谢大家的指点!

http://blog.csdn.net/csh624366188/article/details/6695702

非常谢谢你给的链接,我这个问题都一天多了,我刚才看了那个链接,然后试着弄到我的项目中,完美的解决了问题,非常感谢!

附上我的解决方法:

public class DownFileAction {

    private String fileName;//由页面传递过来

    public String execute() throws UnsupportedEncodingException{
        return "success";
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) throws UnsupportedEncodingException {
        this.fileName = new String(fileName.getBytes("ISO-8859-1"),"UTF-8");
    }

    //获取输入流
    public InputStream getInputStream() throws FileNotFoundException, UnsupportedEncodingException {

        String rootPath = ServletActionContext.getRequest().getSession().getServletContext().getRealPath("upload");

        HttpServletResponse response = ServletActionContext.getResponse();
        response.setHeader("Content-Disposition", "attachment;fileName="+java.net.URLEncoder.encode(fileName,"UTF-8"));
       return ServletActionContext.getServletContext().getResourceAsStream(rootPath+"\\"+fileName);
    }

} 
 <action name="downFile" class="com.mx.struts2.action.DownFileAction">
            <result type="stream">
                <param name="contentType">application/octet-stream</param>
                <param name="inputName">inputStream</param>
                <param name="bufferSize">2048</param>
            </result>
</action>