ajax传参遇到中文乱码问题解决方法
不用引其他js包 encodeURI方法是js底层有的方法
js方法
var url="<%=request.getContextPath()%>/laPlanForm/forUpdate4DistributeDepart.so?planid="+planIds+"&departname="+encodeURI(encodeURI(departName))+"&struid="+struId+"&batch=true";
var param="";
var myAjax=new Ajax.Request(url,{method:'post',parameters:param,onSuccess:doOnCompleteSelectMore,asynchronous:true});
java代码:
String distributeDepartName = request.getParameter("departName");
try {
if(null!=distributeDepartName&&!"".equals(distributeDepartName)){
distributeDepartName = URLDecoder.decode(distributeDepartName, "UTF-8");
}
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
};
相关推荐
}'这是取得Action穿过来的值,如果想取当前标题改为document.title. <a href="javascript:void" onclick="postToWb();" class="t