servlet 发送到客户端的数据编码设置
来源:互联网 发布:金蝶软件客服电话 编辑:程序博客网 时间:2024/06/06 19:39
setCharacterEncoding
void setCharacterEncoding(java.lang.String charset)
- Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8. If the character encoding has already been set by
setContentType(java.lang.String)
orsetLocale(java.util.Locale)
, this method overrides it. CallingsetContentType(java.lang.String)
with theString
oftext/html
and calling this method with theString
ofUTF-8
is equivalent with callingsetContentType
with theString
oftext/html; charset=UTF-8
.This method can be called repeatedly to change the character encoding. This method has no effect if it is called after
getWriter
has been called or after the response has been committed.上面是api的内容:
用法:setCharacterEncoding("UTF-8");
上述api的基本翻译如下:
给准备要发送到服务端响应对象response数据的MIME字符集编码进行设置,举个例子 UTF-8
如果setCharacterEnconding方法已经设置,会覆盖另外两种方法的设置。
setContentType("String
oftext/html; charset=UTF-8");
上面的解释道这两种设置方式是等价的。
另外如果这个方法在getWriter方法之后设置,或者在response对象已经提交之后设置,此方法就失效了。
0 0
- servlet 发送到客户端的数据编码设置
- Android 发送json数据到servlet
- .net UDP 发送数据到客户端注意事项
- 客户端发送GET请求数据到服务器
- 客户端发送POST请求数据到服务器
- servlet设置编码的问题
- 关于servlet服务端接收客户端发送的List<?>数据的问题
- 设置Oracle客户端的编码
- 利用javascript把javascript的数据同form的数据一起发送到servlet中
- servlet向客户端发送数据(PrintWriter ,ServletOutputStream)
- android与servlet交互 通过数据库把存放的十六进制的图片数据传递到客户端
- Servlet设置客户端缓存的过期时间
- ajax获取servlet发送的数据
- 发送设置编码的Url请求
- HttpClient设置发送内容的编码格式
- JSP/Servlet设置编码格式的问题
- servlet和jsp当中的编码设置
- JSP/Servlet设置编码格式的问题
- 内核同步机制之原子操作&优化和内存屏障
- HDU携程决赛最短路径的代价/USTC 1280 Finding Shortest Path 求最短路边+最小割
- 给定一个带通配符问号的数W,问号可以代表任意一个一位数字。 再给定一个整数X,和W具有同样的长度。 问有多少个整数符合W的形式并且比X大?
- [BZOJ2594][WC2006][LCT][MST]水管局长数据加强版
- 【wikioi】1225八数码问题
- servlet 发送到客户端的数据编码设置
- 动态的创建窗口(以一个按钮为例)
- java计算百分比的实现
- DAVINCI DM3730开发攻略——DVSDK4_03和双核CODEC机制介绍
- [Wikioi 1135][NOIP 2011提高组]选择客栈(疑难题)
- 三层架构与MVC & 设计模式的较量
- Java基础篇之抽象类和接口的联系与区别
- 让你提前认识软件开发(21):C程序中的定时器
- python rsa加解密