<a href 链接传递中文参数后台接受乱码
1、前台jsp(UTF-8编码):
<a href="download.action?flag=1&downfile=<%=name%>">下载</a>
其中:name为jsp中的字符串变量,以URL形式传递参数到后台action
2、后台action:(struts2中利用set方法接收参数)
private String downfile;
public void setDownfile(String downfile){
this.downfile = downfile;
}
3、中文乱码解决
String temp_file = new String(downfile.getBytes("ISO-8859-1"),"UTF-8");
转载于:https://blog.51cto.com/carrie1314/1350402