If you don't want to see plain text in the url, for example, http://localhost:8080/template_1/login.action?user=Zhang San
You can use the URL Decoder.decode of js encodeURI to encrypt the URL
(1) JS puts the data var val = encodeURI (encodeURI ("The value to be passed to the server")); //Call encodeURI twice
href="<%=basePath%>recordManager/test_js_decodeURI.action?params="+val
(2) This is the server side
The code copy is as follows:
HttpServletRequest request = ServletActionContext.getRequest();
String vString = request.getParameter("params");
System.out.println("Before conversion:"+vString);
String deString = URLDecoder.decode(vString, "UTF-8");
System.out.println("Converted:"+deString);
UTF-8 is consistent with the encoding on the page, for example: pageEncoding="UTF-8" on the jsp page, here it is UTF-8
You can see if you right-click to encode on ie. If pageEncoding="UTF-8" on jsp, right-click to encode uncode (UTF-8), if pageEncoding="GBK" on jsp, right-click to encode on ie (simplified Chinese gb2312)