在请求目标中找到无效字符。有效字符在RFC 7230和RFC 3986中定义
作者:互联网
tomcat部署war包,页面传递中文参数报错。
传递中文参数需要编码和解码
var targetUrl = "${basePath}/search?keyword=" + encodeURIComponent(encodeURIComponent(strSearch)); window.location.href= targetUrl;
@RequestMapping("search") public String search(Model model,String keyword) throws UnsupportedEncodingException { keyword = URLDecoder.decode(keyword, "utf-8"); model.addAttribute("keyword",keyword); return "web/search"; }
标签:字符,search,String,keyword,RFC,7230,targetUrl,model 来源: https://www.cnblogs.com/hsiaochinchin/p/15502821.html