时间:2021-07-01 10:21:17 帮助过:18人阅读
HttpServletRequest request = ServletActionContext.getRequest();
String vString = request.getParameter("params");
System.out.println("转换前:"+vString);
String deString = URLDecoder.decode(vString, "UTF-8");
System.out.println("转换后:"+deString);
UTF-8是和页面上的编码保持一致 比如:jsp页面上 pageEncoding="UTF-8" 这里就要是UTF-8
在ie上右键编码就能看到,如果jsp上pageEncoding="UTF-8" ie上右键编码uncode(UTF-8),如果jsp上pageEncoding="GBK",那么 ie上右键编码(简体中文gb2312)