ajax在tomcat 上正常,部署到weblogic上就出现问题了,提示下载action路径 :
var fileId ;
fileId = 'file';
$.ajaxFileUpload(
{
url:path+'shortMessage/importContactAction.jcms',
type:'POST',
secureuri:false,
fileElementId:fileId,
dataType: 'text',
success: function (data)
{
alert(data)
},
error: function (data)
{
alert("文件读取错误");
}
}
);
问题出在乱码上,修改方法 :
success: function (data)
{
data = decodeURIComponent(decodeURIComponent(escape(data)));
alert(data)
},
java 代码:
PrintWriter out1 = resp.getWriter();
str = java.net.URLEncoder.encode(str.toString(), "utf-8");
out1.print(str);