前端js需要对汉字进行编码
var topicName=$("#search-topic").val(); if(!topicName){ alert("培训主题不能为空!"); }else{ window.location.href="searchTopic.do?type="+trainType+ "&topicName="+encodeURI(encodeURI(topicName)); }
后台需要对其进行解码
try{
topicName=URLDecoder.decode(topicName, "UTF-8");
}catch (Exception e) {
e.printStackTrace();
}