Output as a string.
1. response.getWriter().write("Hello China hello");
If this is output. The browser result is:
2. Add code
response.setCharacterEncoding("UTF-8");response.getWriter().write("Hello China hello");The browser result is:
This is because of the browser parsing problem.
Add code:
response.setHeader("Content-type", "textml;charset=UTF-8");response.setCharacterEncoding("UTF-8");response.getWriter().write("Hello China hello");The browser result is:
The above is the full description of HttpServletResponse in Java in Java that I introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply you in time. Thank you very much for your support to Wulin.com website!