$.ajax({ type:'get',
url:'updateAttendanceContent.action',
data:'attenRegistContent.registId='+id+'&attenRegistContent.RContent='+encodeURI(value,"UTF-8"),
success:function(msg){ alert(msg); window.location.reload(); }, error:function(msg){ alert("更新失败!"+msg); } })
在前台ajax函数那 把要传的中文字符串使用encodeURI(str,enc)函数处理一下
如果后台还是有乱码的话,
在后台使用URLDecoder.decode(str,enc)处理一下字符串
String RContent = null;
try {
RContent = URLDecoder.decode(content.getRContent(),"UTF-8");
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
attenRegistContent.setRContent(RContent);