用URLEncode类的encode编码后再传
<% String h_imgpath = URLEncoder.encode(h.getH_imgpath(), "utf-8"); %>
<a href="<%=request.getContextPath()%>/AdminHealthinfoDelete?id=<%=h.getId() %>&h_imgpath=<%=h_imgpath %>">删除</a>
但是不知道为啥,再servlet里接收后就不用解码了,可以直接打印出来,难道说在地址栏传值得时候浏览器进行了解码?
String h_imgpath = request.getParameter("h_imgpath");
String h_imgpath1 = URLDecoder.decode(h_imgpath, "utf-8");
System.out.println(h_imgpath);
System.out.println(h_imgpath1);
打印结果: