Request请求方式设置编码

版权声明:最终解释权归属Hern所有,恒! https://blog.csdn.net/qq_36761831/article/details/86532432

1、通用方法(适用于任何请求方式)

		String parameter = request.getParameter("标签命名");
		byte[] bytes = parameter.getBytes("ISO8859-1");
		String str = new String(bytes,"UTF-8");

2、只适用 POST 方法

注意:该方法只适用于 POST 请求方式,GET 请求方式无效。

               request.setCharacterEncoding("UTF-8");

猜你喜欢

转载自blog.csdn.net/qq_36761831/article/details/86532432