1.在js中url 定义如下:
encodeURIComponent(encodeURIComponent(searchTxt)))进行编码
var searchTxt = "搜索内容"; var url = "http://localhost:8080/user/list?name="+encodeURIComponent(encodeURIComponent(searchTxt)));2.java中解码( java.net.URLDecoder.decode)
String name = con().get("name")!=null?con().get("name"):""; try { name = java.net.URLDecoder.decode(name, "UTF-8"); } catch (Exception e) { e.printStackTrace(); }