码迷,mamicode.com
首页 > 其他好文 > 详细

Servlet中文乱码的解决方法

时间:2016-04-14 22:05:08      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:

    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//以下两句,设置UTF-8编码,可以解决乱码 resp.setCharacterEncoding(
"UTF-8"); resp.setHeader("content-type","text/html;charset=UTF-8");
resp.getWriter().write(
"<a href=\"www.example.com\">这是测试文本</a>"); }

 

Servlet中文乱码的解决方法

标签:

原文地址:http://www.cnblogs.com/Wcy100/p/5392776.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!