Jquery转汉字到 后台 乱码问题

<% String type = new String(request.getParameter("mddname").getBytes("ISO-8859-1"),"UTF-8");%> //这里是 接到 传过来的值, 并转码utf-8格式
function GetSCAPEList()
{
  var type;
  var a=document.getElementById("jingdian").innerText
$.ajax({
type: "get",
dataType: "json",
url:SetUrlRefresh("../service/GetSCAPE.jsp"),
data:"type="+ encodeURIComponent(encodeURIComponent(a)),   //这里传值进去
error: function(XmlHttpRequest, textStatus, errorThrown) {
// alert("刷新 ~频率有点快 亲~~~~");
},
success: function(d) {
switch (d.result) {
case '0':
alert(d.returnval);
break;
case '1':
$("#Home_SCAPEList").setTemplateElement("SCAPEList", null, { filter_data: false });
$("#Home_SCAPEList").processTemplate(d);
break;
default:
alert(d.result);
break;
}
}
});

}

//然后跳转到后台               这里用jsp来  演示

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@page import="com.journey.frameword.dao.*"%>
<%@page import="com.journey.frameword.dao.DaoImpl"%>
<% Dao dao = new DaoImpl(); %>
<%  
String type =request.getParameter("type").trim(); //这里是 显示成一个  十六进制的   字符串
type=java.net.URLDecoder.decode(type,"UTF-8");  //这两句   转码 utf-8  成功

List list = dao.executeQueryForList("SELECT mddcontent FROM mafengwo_table_1 WHERE mddname = '"+type+"' limit 0,1"); 
java.util.Map map0 = (java.util.Map)list.get(0);
System.out.println(map0.get("mddcontent"));
%>
{result:"1",table:[
{id :"0",minPic:"<%=map0.get("mddcontent")%>"}
]}





版权声明:本文为u010310183原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。