JSP中的编码设置:
1. pageEncoding:<%@ page pageEncoding="UTF-8"%>
jsp页面编码: jsp文件本身的编码
2. contentType: <%@ page contentType="text/html; charset=UTF-8"%>
web页面显示编码:jsp的输出流在浏览器中显示的编码
3. html页面charset:<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
web页面输入编码: 输入框输入的字体编码
4. setCharacterEncoding:request.setCharacterEncoding(),response.setCharacterEncoding()
web服务器输入的请求流: web Server相应浏览器的请求数据
一、request.setCharacterEncoding():用来确保发往服务器的参数以汉字的编码来提取,设置从request中取得的值或从数据库中取出的值。
二、response.setCharacterEncoding():设置HTTP 响应的编码,用于设置服务器给客户端的数据的编码
5 .setContentType:response.setContentType()
web服务器输出的响应流: web Server相应浏览器的输出数据
1. pageEncoding:<%@ page pageEncoding="UTF-8"%>
jsp页面编码: jsp文件本身的编码
2. contentType: <%@ page contentType="text/html; charset=UTF-8"%>
web页面显示编码:jsp的输出流在浏览器中显示的编码
3. html页面charset:<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
web页面输入编码: 输入框输入的字体编码
4. setCharacterEncoding:request.setCharacterEncoding(),response.setCharacterEncoding()
web服务器输入的请求流: web Server相应浏览器的请求数据
一、request.setCharacterEncoding():用来确保发往服务器的参数以汉字的编码来提取,设置从request中取得的值或从数据库中取出的值。
二、response.setCharacterEncoding():设置HTTP 响应的编码,用于设置服务器给客户端的数据的编码
5 .setContentType:response.setContentType()
web服务器输出的响应流: web Server相应浏览器的输出数据
本文详细介绍了JSP中的各种编码设置,包括页面编码、输出流编码、请求流编码及响应流编码等,帮助开发者理解并正确配置JSP应用的字符集。
1142

被折叠的 条评论
为什么被折叠?



