@Override
public void doPost(HttpServletRequest reqeust, HttpServletResponse response)
throws ServletException, IOException {
//PrintWriter out = response.getWriter();在还没有给response指定编码格式时就获取了他的输出流,所以一直乱码
reqeust.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter(); //在设置完编码以后在获取输出流就好了。
jsonService = new JsonService();
String jsonString = JsonTools.createJsonString("persons", jsonService.getPersonList());
out.println(jsonString);
out.flush();
out.close();
}