方法一:
jQuery.ajax({
type:"POST",
url:"${ctx}/offer.do",
data:{
'method':'isNameExist',
'type':'area',
'id':id==""?null:id,
'name':encodeURIComponent(offerAreaName)
},
async:false,
success:function (data) {
bool = data;
}
});
action里特别设置:
String offerAreaName= request.getParameter("offerAreaName");
if(StringUtils.isNotEmpty(offerAreaName)){
productName = new String(offerAreaName.getBytes("iso8859-1"),"UTF-8");
}
方法二:
window.encodeURI(window.encodeURI(strBuf)) 编译后在传
处理方法中(action 或者 service):
try {
strBuf= java.net.URLDecoder.decode(strBuf,"UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}