request.getRequestDispatcher("login.html");页面乱码

在使用 request.getRequestDispatcher("Login.html").include(request, response);时,中文显示出现了乱码,在dopost方法里也已经进行了设置,
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
request.setCharacterEncoding("utf-8");
PrintWriter out =response.getWriter();
还是不行,出现乱码肯定是页面解析编码是出现问题,
最后在
Login.html 文件的<head>中更改编码<meta http-equiv="content-type" content="text/html" charset="GB2312">将原来的utf-8改成了gb2312.乱码问题解决。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章