request和response

处理乱码方式:

get请求:获取字符串之后使用new String(name.getBytes("iso-8859-1"),"utf-8)进行重新编码,另外一种方法是request.setCharactorEncoding("utf-8")同时还要设置tomcat的配置文件,第三种:

在server.xml中添加URIEncoding=“utf-8”

post请求:request.setCharactorEncoding("utf-8")

设置响应编码格式:response.setCaractorEncoding("gbk"):

请求转发:

不同servlet之间的数据共享:

重定向:

原文地址:https://www.cnblogs.com/zrmj/p/11378171.html