response.setCharacterEncoding(“gbk”);
The jar package has been imported, and the following error is prompted:
The method setCharacterEncoding(String) is undefined for the type HttpServletResponse
Simply put, the setCharacterEncoding method is undefined.
Solution one:
response.setCharacterEncoding("gbk"); is not available in Servlet2.3, at least version 2.4 is required, if it is lower than version 2.4, you can use the following method:
response.setContentType("text/html;charset=gbk") ;
Sure enough